我试图理解CodeIgniter中的路由是如何工作的。 我想使用正常的访问边,这不是一种用户区或一些特殊的东西-只有在网站的主要根的正常链接。 所以我试了一下。 我已经在routes.php中设置了 $route['/'] = "index"; 我已经创建了控制器名称Frontend.php和一个名为Frontend_modell.php的模型 控制器(无事可做) public function index()
{
redirect(site_url('index'));
} The Modell publi
我使用了CodeIgniter一段时间,现在搬到了Laravel。
在CodeIgniter中创建控制器时,它会自动使用/控制器/方法作为路由。例如:
class Users extends CI_Controller {
public function index() {
// Something here
}
public function view() {
// Something here
}
}
现在我们可以去http://example.com/users/index或http://example.com/users
我已经在codeigniter中创建了登录页面,并在应用程序命中时将其设为默认控制器,但当应用程序命中时,我得到404页未找到错误。请在main.php配置和路由文件更改时找到以下控制器代码。我的控制器名称是main.php,代码如下 <?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Main extends CI_Controller {
//functions
function login()
{
我在用codeigniter。我目前正在处理我的路由和控制器。上周,我浏览了一下symfony2,我喜欢上了一些东西:
class DefaultController extends Controller
{
public function indexAction()
{
return $this->render('LVIndexBundle:Default:index.html.twig');
}
public function servicesAction()
{
return $this-&
我已经在application\controllers中创建了一个文件夹abc。
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Acc_controller extends CI_Controller {
public function index()
{
$this->load->view('abc/index1');
}
}
之后,我在view\abc中创建了文
我有一个非常简单的路由规则,用来放在CodeIgniter的路由配置文件中。
$route['building/(:num)'] = 'building/$1';
路由规则在没有问题的情况下工作得很好,我发现的唯一问题是,当将变量传递给参数时,它会显示以下错误消息
An Error Was Encountered
The URI you submitted has disallowed characters.
我知道我的规则告诉CodeIgniter只接受数字作为参数,但我需要做的是,在参数错误的情况下,它必须重定向到另一个定义的页面或url,而不是显示这个
CI为控制器查找Segment[1] (在控制器目录中),为方法查找Segment[2]。现在,我有了业务应用程序的specific需求,它需要我不想让CI看起来,或者强行转到控制器目录加载,但我会有类似这样的"domainURL/module_identifier_id/controller/method/"。
在这里,每个请求都将与其相关模块的标识符ID一起到来,该ID将完整的模块配置和其他数据(controller files, module location where it was uploaded, all menus and their URLs which wi