问题描述
我刚刚在PHP 5.4上安装了woocommerce 2.0(在Wordpress上),我得到了:
I just installed woocommerce 2.0 (on Wordpress) on PHP 5.4, and I got this:
我检查了文件,发现WC_Payment_Gateway
没有方法process_payment()
.我需要知道如何解决此问题(而不是通过设置error_reporting()
来解决).
I check the files and found that WC_Payment_Gateway
have no method process_payment()
.I need to know how to resolve this (not by setting error_reporting()
).
什么是PHP中的 严格标准 ?
在什么情况下我们会收到该错误?
What is Strict Standards in PHP exactly?
In what condition so we get that error?
推荐答案
WC_Payment_Gateway
在abstract-wc-payment-gateway.php
中定义并声明一个方法
WC_Payment_Gateway
is defined in abstract-wc-payment-gateway.php
and declares a method
function process_payment() {}
而WC_Gateway_BACS
将其定义为
function process_payment( $order_id ) { ...
(也许您混用了WC_Payment_Gateway和WC_Payment_Gateway s ).
(maybe you mixed up WC_Payment_Gateway and WC_Payment_Gateways).
因此,不同的签名(0个参数对1个参数)->严格错误.
由于它似乎总是与一个参数一起使用,因此您可以更改
So, different signature (0 parameters vs 1 parameter) -> strict error.
Since it seems* to be used always with one parameter you could change
function process_payment() {}
到
function process_payment($order_id) {}
(*)请记住,我仅在最近五分钟才知道woocommerce,所以请不要相信我.
(*) keep in mind I know of woocommerce only since the last five minutes, so don't take my word for it.
这篇关于严格标准:“"的声明应与“"兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!