我遵循CodeIgniter的教程“在20分钟内创建一个博客”,我很难让助手、锚和脚手架功能工作。
我似乎无法使用帮助器和锚函数在我的HTML页面上创建链接。
我把
$this->load->helper('url'); $this->load->helper('form');
在parent::Controller();下的构造函数中
和
<p><?php echo anchor('blog/comments','Comments'); ?></p>在这个教程中指定的foreach循环中。但我没有得到链接的出现。
当我按照视频中的指示查看源时,这一行丢失了(但它在视频中):
<form method= "post" action = "http://www.example.com/CodeIgniter/index.php/blog/comment_insert">
其次,每当我试图在浏览器中访问CodeIgniter的脚手架页面时,我都会得到404 Page错误,如下所示:
localhost/codeignitor/index.php/blog/scaffolding/mysecretword
我可以
localhost/codeignitor/index.php/blog
只是很好。我按照CodeIgnitor在他们的“20分钟内创建博客”中的说明,将我的数据库设置存储在database.php文件中;并通过在autoload.php的核心数组中插入“数据库”来自动连接到数据库;我添加了这两种方法
parent::Controller();和$this->load->scaffolding('myTableName')到博客的构造函数。它仍然给了我这个404。
如有任何协助,将不胜感激。提前谢了?
发布于 2010-03-28 14:56:57
脚手架是不推荐的,但它直到2.0才被移除,并且在1.7.2中仍然有效。
URL中有/scaffolding/,这是不必要的,只需使用脚手架触发器即可。
我不知道为什么您的助手不能工作,您的语法看起来很好,除非您的foreach循环中没有任何数据。<form...>行来自调用<?php echo form_open('form_controller_or_whatever'); ?>
发布于 2013-03-15 06:30:34
localhost/codeignitor/index.php/blog/mysecretword就够了..。
看看这个网站:http://www.schobbing.de/user_guide/general/scaffolding.html,你会明白的.
https://stackoverflow.com/questions/2532822
复制相似问题