当前位置: 首页>>代码示例>>PHP>>正文


PHP Controller\Controller类代码示例

本文整理汇总了PHP中Cake\Controller\Controller的典型用法代码示例。如果您正苦于以下问题:PHP Controller类的具体用法?PHP Controller怎么用?PHP Controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Controller类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     $this->Controller = new CacheComponentTestController();
     $this->Controller->startupProcess();
     $this->Controller->request->session()->delete('CacheMessage');
     $this->Controller->Cache->config('debug', true);
 }
开发者ID:dereuromark,项目名称:cakephp-cache,代码行数:12,代码来源:CacheComponentTest.php

示例2: testInnerComponentsAreNotEnabled

 /**
  * test that component components are not enabled in the collection.
  *
  * @return void
  */
 public function testInnerComponentsAreNotEnabled()
 {
     $mock = $this->getMock('Cake\\Event\\EventManager');
     $controller = new Controller();
     $controller->eventManager($mock);
     $mock->expects($this->once())->method('on')->with($this->isInstanceOf('TestApp\\Controller\\Component\\AppleComponent'));
     $Collection = new ComponentRegistry($controller);
     $Apple = $Collection->load('Apple');
     $this->assertInstanceOf('TestApp\\Controller\\Component\\OrangeComponent', $Apple->Orange, 'class is wrong');
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:15,代码来源:ComponentTest.php

示例3: _getView

 protected function _getView($viewVars = [])
 {
     $Request = new Request();
     $Response = new Response();
     $Controller = new Controller($Request, $Response);
     $builder = $Controller->viewBuilder();
     $builder->className('JsonApi\\View\\JsonApiView');
     if ($viewVars) {
         $Controller->set($viewVars);
     }
     return $Controller->createView();
 }
开发者ID:josbeir,项目名称:cakephp-json-api,代码行数:12,代码来源:JsonApiViewTest.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param \Cake\Controller\Controller $Controller Controller instance.
  */
 public function __construct(Controller $Controller = null)
 {
     if ($Controller) {
         $this->_Controller = $Controller;
         $this->eventManager($Controller->eventManager());
     }
 }
开发者ID:ansidev,项目名称:cakephp_blog,代码行数:12,代码来源:ComponentRegistry.php

示例5: testPaginate

 /**
  * @return void
  */
 public function testPaginate()
 {
     Configure::write('Paginator.limit', 2);
     $ToolsUser = TableRegistry::get('ToolsUsers');
     $count = $ToolsUser->find('count');
     $this->assertTrue($count > 3);
     $this->Controller->loadModel('ToolsUsers');
     $result = $this->Controller->paginate('ToolsUsers');
     $this->assertSame(2, count($result->toArray()));
 }
开发者ID:dereuromark,项目名称:cakephp-tools,代码行数:13,代码来源:ControllerTest.php

示例6: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     // $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['controller' => 'IndocreatorAdmin', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'IndocreatorAdmin', 'action' => 'display', 'home']]);
 }
开发者ID:portsign,项目名称:produksatu,代码行数:16,代码来源:AppController.php

示例7: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'authenticate' => ['Form' => ['fields' => ['username' => 'username', 'password' => 'password']]], 'loginRedirect' => ['controller' => 'Projects', 'action' => 'index'], 'logoutRedirect' => ['controller' => 'Projects', 'action' => 'index']]);
 }
开发者ID:Custodia,项目名称:caketickets,代码行数:16,代码来源:AppController.php

示例8: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->helpers[] = 'Shrink.Shrink';
     $this->loadComponent('Auth', ['authorize' => 'Controller', 'authenticate' => ['Form' => ['fields' => ['username' => 'email', 'password' => 'password']]], 'loginAction' => ['controller' => 'CustomStaticPages', 'action' => 'index'], 'logoutAction' => ['controller' => 'CustomStaticPages', 'action' => 'index']]);
     //$this->Auth->allow();
 }
开发者ID:ricardohenriq,项目名称:shooping,代码行数:14,代码来源:AppController.php

示例9: __construct

 /**
  * Constructor.
  *
  * @param \Cake\Controller\Controller $Controller
  */
 public function __construct(Controller $Controller = null)
 {
     if ($Controller) {
         $this->_Controller = $Controller;
         $this->_eventManager = $Controller->getEventManager();
     } else {
         $this->_eventManager = new EventManager();
     }
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:14,代码来源:ComponentRegistry.php

示例10: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['prefix' => false, 'controller' => 'Home', 'action' => 'index'], 'logoutRedirect' => ['prefix' => false, 'controller' => 'Users', 'action' => 'login']]);
 }
开发者ID:AdBouli,项目名称:hotel-manager,代码行数:16,代码来源:AppController.php

示例11: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Crud.Crud', ['actions' => ['Crud.Index', 'Crud.View', 'Crud.Add', 'Crud.Edit', 'Crud.Delete'], 'listeners' => ['Crud.Api', 'Crud.ApiPagination', 'Crud.ApiQueryLog']]);
     $this->loadComponent('Auth', ['storage' => 'Memory', 'authenticate' => ['Form' => ['scope' => ['Users.active' => 1], 'fields' => ['username' => 'email', 'password' => 'password']], 'ADmad/JwtAuth.Jwt' => ['parameter' => 'token', 'userModel' => 'Users', 'scope' => ['Users.active' => 1], 'fields' => ['username' => 'id'], 'queryDatasource' => true]], 'unauthorizedRedirect' => false, 'checkAuthIn' => 'Controller.initialize', 'authorize' => ['Controller']]);
 }
开发者ID:chrisshick,项目名称:app,代码行数:16,代码来源:AppController.php

示例12: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'authenticate' => ['Form' => ['fields' => ['username' => 'email', 'password' => 'password'], 'finder' => 'auth']], 'loginAction' => ['controller' => 'Users', 'action' => 'login'], 'authError' => 'Ingrese sus datos', 'loginRedirect' => ['controller' => 'Users', 'action' => 'home'], 'logoutRedirect' => ['controller' => 'Users', 'action' => 'login'], 'unauthorizedRedirect' => $this->referer()]);
 }
开发者ID:edsonmgoz,项目名称:pocake,代码行数:16,代码来源:AppController.php

示例13: initialize

 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authorize' => ['Controller'], 'loginRedirect' => ['controller' => 'Associations', 'action' => 'init'], 'logoutRedirect' => ['controller' => 'Pages', 'action' => 'home']]);
 }
开发者ID:raguilar0,项目名称:TCU_FEUCR,代码行数:7,代码来源:AppController.php

示例14: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['authenticate' => ['Form' => ['userModel' => 'Users']]]);
 }
开发者ID:mattford,项目名称:Coordino,代码行数:16,代码来源:AppController.php

示例15: initialize

 /**
  * Initialization hook method.
  *
  * Use this method to add common initialization code like loading components.
  *
  * e.g. `$this->loadComponent('Security');`
  *
  * @return void
  */
 public function initialize()
 {
     parent::initialize();
     $this->loadComponent('RequestHandler');
     $this->loadComponent('Flash');
     $this->loadComponent('Auth', ['loginRedirect' => '/admin', 'authError' => 'Você possivelmente digitou suas credenciais erradas!', 'logoutRedirect' => ['prefix' => false, 'controller' => 'Pages', 'action' => 'display', 'home']]);
 }
开发者ID:richellyitalo,项目名称:estudoscakephp,代码行数:16,代码来源:AppController.php


注:本文中的Cake\Controller\Controller类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。