问题描述
我刚刚在 PHP 5.4 上安装了 woocommerce 2.0(在 Wordpress 上),我得到了这个:
I just installed woocommerce 2.0 (on Wordpress) on PHP 5.4, and I got this:
严格标准:WC_Gateway_BACS::process_payment()声明应该与 WC_Payment_Gateway::process_payment() 兼容D:mypathohtdocswordpresspluginswoocommerceclassesgatewaysacsclass-wc-gateway-bacs.php在线...
我检查了文件,发现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_Gateways).
(maybe you mixed up WC_Payment_Gateway and WC_Payment_Gateways).
因此,不同的签名(0 个参数 vs 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.
这篇关于严格的标准:""的声明应与""兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!