严格标准:“"的声明应与“"兼容 [英] Strict Standards: Declaration of ' ' should be compatible with ' '

查看:96
本文介绍了严格标准:“"的声明应与“"兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在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:\ my \ path \ to \ htdocs \ wordpress \ plugins \ woocommerce \ classes \ gateway \ bacs \ class-wc-gateway-bacs.php 上线...

Strict Standards: Declaration of WC_Gateway_BACS::process_payment() should be compatible with WC_Payment_Gateway::process_payment() in D:\my\path\to\htdocs\wordpress\plugins\woocommerce\classes\gateways\bacs\class-wc-gateway-bacs.php on line...

我检查了文件,发现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_Gatewayabstract-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.

这篇关于严格标准:“"的声明应与“"兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆