[英]Error using Rest plugin in cakephp
我在cakephp中实现Web服务。
我在这里找到一个插件可以做到这一点。 当我执行安装步骤时,任何访问controller / action.json的尝试都将请求此错误:
Strict (2048): Declaration of RestComponent::initialize()
should be compatible with Component::initialize(Controller $controller)
它应该兼容是什么意思?
覆盖父类方法的类方法应实现与被覆盖方法相同的签名,即RestComponent
的intialize
方法应如下所示( https://github.com/cakephp/.../Component。 php#L109 ):
public function initialize(Controller $controller)
而不是这样( https://github.com/kvz/cakephp-rest-plugin/...RestComponent.php#L153 ):
public function initialize(&$Controller)
CakePHP内置了REST API ,除非您正在做尚未完成的事情。
用这个
公共函数initialize(Controller $ controller)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.