小编Mat*_*kas的帖子

如何在CodeIgniter中使用适当的面向对象模型和构造函数?

我现在创建CodeIgniter模型的方式是(即没有构造函数,必须一直传递userID并限制为一个对象):

$this->load->model('User');
$this->user->set_password($userID, $password);
Run Code Online (Sandbox Code Playgroud)

但我想这样做:

$this->load->model('User');
$User = new User($userID);
$User->set_password($password);
Run Code Online (Sandbox Code Playgroud)

更新:也许只是一个用户模型是一个糟糕的例子.

例如,如果我有一个包含各种项目的购物清单,我想以这种方式使用PHP:

$this->load->model('List');
$this->load->model('Item');

$List = new List();
$items[] = new Item($itemName1, $itemPrice1);
$items[] = new Item($itemName2, $itemPrice2);

$List->add_items($items);
Run Code Online (Sandbox Code Playgroud)

CodeIgniter在以这种方式处理PHP OO时感觉从根本上破裂了.有没有人有任何解决方案仍然可以在每个模型中使用superobject?

php model codeigniter

10
推荐指数
1
解决办法
6445
查看次数

你如何从transactionId获得payKey?

我一直在使用PayPals IPN来接收和处理付款,并将transactionId存储为参考.

现在是时候能够通过我正在开发的系统退还付款,这就是斗争.

当使用GetPaymentDetails.php在更新的PHP SDK中的示例的payKey字段中输入transactionId时,使用正确的身份验证详细信息和应用程序ID,我得到:

Error ID: 580022
Domain: PLATFORM
Severity: Error
Category: Application
Message: Invalid request parameter: payKey with value [REMOVED (transactionId)]
Parameter: Array
Run Code Online (Sandbox Code Playgroud)

这是可以理解的,因为它期待一个payKey.现在,我可以改变$pdRequest->payKey = $payKey;,以$pdRequest->transactionId = $payKey;按规范.现在应该将transactionId作为transactionId发送并运行,但我得到了响应:

Error ID: 520002
Domain: PLATFORM
Severity: Error
Category: Application
Message: Internal Error
Run Code Online (Sandbox Code Playgroud)

好的,所以有些东西被打破了.我怀疑他们现在不允许将transactionId用作参考,并且没有更新他们的文档(典型).我怀疑这是因为我使用的原始SDK包括transactionId的字段,以及trackingId和另一个标识符.但是现在更新的SDK只要求payKey.

现在我被卡住了.我已经收集了数千个实时transactionIds.你知道我如何为每笔交易获得payKey,或者解决原始问题.

谢谢

更多信息:

以下是发送的HTTP标头:

X-PAYPAL-SECURITY-SIGNATURE: [removed]
X-PAYPAL-SECURITY-USERID: [removed]
X-PAYPAL-SECURITY-PASSWORD: [removed]
X-PAYPAL-APPLICATION-ID: [removed]
X-PAYPAL-REQUEST-SOURCE: PHP_SOAP_SDK_V1.4
X-PAYPAL-DEVICE-IPADDRESS: 127.0.0.1
X-PAYPAL-MESSAGE-PROTOCOL: SOAP11
X-PAYPAL-REQUEST-SOURCE: PHP_SOAP_SDK_V1.4
Run Code Online (Sandbox Code Playgroud)

这是内容

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"     xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body><PaymentDetailsRequest>
    <requestEnvelope>
        <errorLanguage>en_US</errorLanguage>
    </requestEnvelope>
    <transactionId>[removed]</transactionId>
</PaymentDetailsRequest></soap:Body> …
Run Code Online (Sandbox Code Playgroud)

php paypal paypal-ipn paypal-adaptive-payments

9
推荐指数
1
解决办法
1166
查看次数

如何解决来自YouTube嵌入的'DOMWindow'错误的'失败'postMessage'

使用YouTube JavaScript/iFrame API我试图寻求视频的不同时间等.

我已经删除了一个演示:http://jsbin.com/yuliponu

var player;
window.onYouTubeIframeAPIReady = function() {
  var iframe = document.createElement("iframe");
  iframe.width = 400;
  iframe.height = 300;
  iframe.id = "youtubeIframe";
  iframe.src = "https://www.youtube.com/embed/yta1WRuiupk?autoplay=1&enablejsapi=1&origin="+encodeURIComponent(window.location.protocol+"//"+document.domain)+"&playsinline=1&rel=0";
  iframe.setAttribute('frameborder', '0');
  iframe.setAttribute('allowFullScreen', '');
  document.getElementById("video").appendChild(iframe);

  player = new YT.Player('youtubeIframe');
};

var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
Run Code Online (Sandbox Code Playgroud)

如果您在控制台中查看,您将看到此错误:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided
('https://www.youtube.com') does not match the recipient window's origin 
('http://jsbin.com').
Run Code Online (Sandbox Code Playgroud)

我需要这个来解决开始使用JavaScript API,但我不知道如何解决它.

更新:

我已经重新启动了我的电脑,并且没有发生错误.如果我再次看到错误,我会更新.

javascript youtube postmessage youtube-api youtube-javascript-api

7
推荐指数
1
解决办法
6492
查看次数

如何使用Javascript检测图片是否模糊?

我在 javascript 字符串中有一个 jpeg 数据 url。有没有办法检测图片的“模糊性”?图片来自正在浏览器中处理的视频。

我知道这并不简单,并且没有明确的模糊度标准,但是有没有办法衡量模糊度?

javascript image image-processing motion-blur

5
推荐指数
1
解决办法
3478
查看次数

cURL 挂在:“没有块,没有关闭,没有大小。假设接近信号结束”

使用此命令将上传流式传输到 Apache/PHP 服务器时

curl -X POST \
-i --data-binary @customfile.app \
-H "Transfer-Encoding: chunked" \
-H "Content-Type: application/app" \
-H "X-CustomHeader1: customvalue1" \
-H "X-CustomHeader2: customvalue2" \
-H "X-CustomHeader3: customvalue3" \
-H "X-CustomHeader4: customvalue4" \
-H "X-CustomHeader5: customvalue5" \
-H "X-CustomHeader6: customvalue6" \
--ignore-content-length \
--progress-bar -vvv \
http://[DOMAIN]/upload.php
Run Code Online (Sandbox Code Playgroud)

命令挂起如下:

* Hostname was NOT found in DNS cache
*   Trying [IP_ADDRESS]...
* Connected to [DOMAIN] ([IP_ADDRESS]) port 80 (#0)
> POST /upload.php HTTP/1.1
> User-Agent: curl/7.37.1
> Host: [DOMAIN]
> …
Run Code Online (Sandbox Code Playgroud)

apache curl tcp

5
推荐指数
1
解决办法
6377
查看次数

PayPals日期格式混淆了strtotime().我能做什么?

PayPals IPN以此格式发送日期 08:29:40 Aug 06, 2012 PDT

当我运行它时,strtotime()我得到了回应1344266980

当这件事发生时date()我得到了2012-08-40 16:29:40.

发生了什么,我该如何解决它.

时区在PHP中设置为Europe/London.

谢谢.

php timezone paypal strtotime

0
推荐指数
1
解决办法
119
查看次数