think\Route::rest PHP 메소드

rest() 공개 정적인 메소드

rest方法定义和修改
public static rest ( string $name, $resource = [] ) : void
$name string 方法名称
리턴 void
    public static function rest($name, $resource = [])
    {
        if (is_array($name)) {
            self::$rest = array_merge(self::$rest, $name);
        } else {
            self::$rest[$name] = $resource;
        }
    }

Usage Example

예제 #1
0
파일: routeTest.php 프로젝트: Lofanmi/think
 public function testRest()
 {
     Route::rest('read', ['GET', '/:id', 'look']);
     Route::rest('create', ['GET', '/create', 'add']);
     Route::rest(['read' => ['GET', '/:id', 'look'], 'create' => ['GET', '/create', 'add']]);
     Route::resource('res', 'index/blog');
     $this->assertEquals(['type' => 'module', 'module' => ['index', 'blog', 'add']], Route::check('res/create'));
     $this->assertEquals(['type' => 'module', 'module' => ['index', 'blog', 'look']], Route::check('res/8'));
 }
All Usage Examples Of think\Route::rest