【发布时间】:2012-08-14 11:55:02
【问题描述】:
出于安全原因,这里提到http://codeigniter.com/user_guide/installation/index.html 我已将系统和应用程序文件夹放在另一个名为 OSW_appnsys 的文件夹中,该文件夹位于 Web 根文件夹上方。现在我在以下目录中有一个名为“Pages”的控制器类和一个“View”函数。
C:\wamp\www\OSW_appnsys\application\controllers
现在,当我从另一个名为 'header.php' 的视图文件中调用控制器 'Pages' 的 'View' 方法时,我得到了像这样的 404 错误
The requested URL /CodeIgniter_2.1.2/pages/view/products was not found on this server.
product 是 URI。
我这样称呼:
<a class="mainmenu" href="<?php echo base_url('pages/view/products')?>">Products</a>
任何帮助将不胜感激。类型
【问题讨论】:
-
如果我通过完整的目录链接直接访问控制器类,则会收到错误“禁止访问。您没有访问应用程序文件夹的权限”
-
如果视图是方法,你的方法的参数是什么?
-
products 是视图文件 products.php 的名称
-
您是否从文档中执行此步骤:
After moving them, open your main index.php file and set the $system_folder and $application_folder variables, preferably with a full path, e.g. '/www/MyUser/system'.? -
传统上我们不会像这样加载视图,我们会调用控制器函数 pages/views 然后 $this->load->view('products');
标签: php codeigniter controller