久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 CakePHP 2.0 中使用 Html Helper 時未定義的變量

Undefined var when using Html Helper in CakePHP 2.0(在 CakePHP 2.0 中使用 Html Helper 時未定義的變量)
本文介紹了在 CakePHP 2.0 中使用 Html Helper 時未定義的變量的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我第一次嘗試 CakePHP 時遇到此錯誤:

I am getting this error on my first attempt of CakePHP:

未定義變量:html [APP/View/Posts/index.ctp, line 13]

Undefined variable: html [APP/View/Posts/index.ctp, line 13]

我有 2.0-alpha 版本,我得到了錯誤的版本還是再次發(fā)生了變化.好像找不到html helper.

I have version 2.0-alpha, have I got the wrong version or what has changed again. Seems it can't find the html helper.

按要求提供更多信息:

這里是 index.ctp 文件

Here is the index.ctp file

<?php foreach ($posts as $post): ?>    

<?php echo $post['Post']['id']; ?>


<?php
##line 13 here
 echo $html->link($post['Post']['title'], array('controller' => 'posts', 'action' => 'view', $post['Post']['id'])); 
?>


<?php echo $post['Post']['created']; ?>

<?php endforeach; ?> 

數據肯定會通過,但我得到的錯誤是第 13 行:

The data is definitely coming through but the error I get is this on line 13:

未定義變量:html [APP/View/Posts/index.ctp, line 13] Fatal error: Call to a member function link() on an non-object in/home

Undefined variable: html [APP/View/Posts/index.ctp, line 13] Fatal error: Call to a member function link() on a non-object in /home

我是新手,希望能幫到你.

I'm quite new I hope this helps.

發(fā)瘋5小時后更新

謝謝伙計們,它已排序,以防萬一有人遇到這個問題,主站點上的教程是舊的,沒有人努力更新它!!...在 index.ctp 示例中替換

Thanks guys it's sorted incase anybody has this problem the tutorial on the main site is an old one and nobody has made the effort to update it!! ...in the index.ctp example replace

$html->link(... 

$this->Html->link(...

推薦答案

從cakephp的manual上看,$html應該是$this->Html在 CakePHP 2.0 中.

From the manual of cakephp, it seems that $html should be $this->Html in CakePHP 2.0.

這篇關于在 CakePHP 2.0 中使用 Html Helper 時未定義的變量的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯(lián)網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作為類名,因為它是保留的 Cake 2.2.x)
Session is lost after an OAuth redirect(OAuth 重定向后會話丟失)
Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分頁排序)
CakePHP Shared core for multiple apps(CakePHP 多個應用程序的共享核心)
Login [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登錄 [ Auth-identify() ] 始終為 false)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命錯誤:允許的內存大小為 134217728 字節(jié)已用盡(嘗試分配 87 字節(jié)))
主站蜘蛛池模板: 亚洲精品国产电影 | 日韩精品人成在线播放 | 91精品国产91久久久久久 | 99久久精品免费看国产免费软件 | 在线观看成年人视频 | 成人黄色在线观看 | 一区二区三区在线免费 | 免费簧片视频 | 色婷婷九月| 久久成人18免费网站 | 国内自拍偷拍一区 | 国产精品久久久久aaaa | 精品久久久久一区二区国产 | 五月婷婷丁香 | 久久国产一区二区三区 | 国产精品精品久久久久久 | 久久精品 | 色综合网站| 国产精品无码永久免费888 | 欧美激情五月 | 国产一区高清 | 精品国产青草久久久久福利 | 国产日韩欧美电影 | 国产精品久久久久久久久久 | 国产一区二区久久 | 国产精品久久久久久av公交车 | 久久久精品网站 | 中国一级特黄真人毛片免费观看 | 久久久久久电影 | 国产视频一区二区 | av在线成人 | 亚洲一区 | 国产一区二区电影网 | 国产欧美一区二区久久性色99 | 国产精品久久久久久久免费大片 | 亚洲成人精品视频 | 久久精品成人热国产成 | 99精品视频免费观看 | 国产精品亚洲精品日韩已方 | 亚洲一区欧美 | 四虎影 |