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

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

问题描述

我刚刚在 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:mypath ohtdocswordpresspluginswoocommerceclassesgatewaysacsclass-wc-gateway-bacs.php在线...

Strict Standards: Declaration of WC_Gateway_BACS::process_payment() should be compatible with WC_Payment_Gateway::process_payment() in D:mypath ohtdocswordpresspluginswoocommerceclassesgatewaysacsclass-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_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.

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

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