and routing requests thinkphp

An inlet module modifies 

public under revised index added define ( 'BIND_MODULE', 'admin'); the entry module to bind to the admin module

? < PHP
 
// [Application inlet File] 

// Define application catalog 
DEFINE ( 'APP_PATH', __DIR__ '/../application/'. ); 

// definition configuration file directory 
DEFINE . ( 'CONF_PATH', the DIR __ __ '/. ./conf/ ' );
 DEFINE (' BIND_MODULE ',' ADMIN ' );
 // load the file frame guide 
the require . __DIR__' /../thinkphp/start.php ';

II. Routing beautification

1. Open Routing Configuration

// whether to open the route 
    'url_route_on' => to true ,
 // whether to enforce routing 
'url_route_must' => false,

2. In the conf directory New route.php

<?php

return [
    'new/:id' => 'admin/index/index',
];

 

3. helper function url () directly modify the url

  public function index($id){
        echo url('admin/index/index',['id'=>11]).'<br />';
        return "index";
    }

 

 

  

Guess you like

Origin www.cnblogs.com/jiangfeilong/p/11198747.html