gpt4 book ai didi

cakephp - cakePHP 2 中的 javascript 助手发生了什么变化?

转载 作者:行者123 更新时间:2023-12-04 17:37:58 51 4
gpt4 key购买 nike

我用过这个 item并收到此错误:

Missing Helper
Error: JavascriptHelper could not be found.
Error: Create the class JavascriptHelper below in file: app/View/Helper/JavascriptHelper.php
<?php
class JavascriptHelper extends AppHelper {
}
确实,这个文件不存在,我试图在我的辅助数组中使用“Js”。
class myClassController expend AppController {
var $helpers = array('Html', 'Js'); // and not 'Javascript');
在代码中,方法 $this->Javascript->codeBlock被调用以添加一个 javascript 方法(在内容的中间而不是标题中),但也没有 $this->Js->codeBlockcodeBlock 。
$output .= $this->Js->codeBlock("datepick('" . $htmlAttributes['id'] . "','01/01/" . $options['minYear'] . "','31/12/" . $options['maxYear'] . "');");

你能解释一下旧的 Javascript 助手发生了什么或者如何让代码工作吗?
还有其他可以与 CakePHP-2.0 一起使用的助手吗?
亲切地,

最佳答案

你读过迁移指南吗?如果现在不这样做:
http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html#xmlhelper-ajaxhelper-and-javascripthelper-removed

XmlHelper, AjaxHelper and JavascriptHelper removed The AjaxHelper and JavascriptHelper have been removed as they were deprecated in version 1.3. The XmlHelper was removed, as it was made obsolete and redundant with the improvements to Xml. The Xml class should be used to replace previous usage of XmlHelper.

The AjaxHelper, and JavascriptHelper are replaced with the JsHelper and HtmlHelper.

JsHelper JsBaseEngineHelper is now abstract, you will need to implement all the methods that previously generated errors.



所以
$this->Js->codeBlock('...');

就是现在
$this->Html->codeBlock('...');

关于cakephp - cakePHP 2 中的 javascript 助手发生了什么变化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12051234/

51 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com