Creating controller error in phpprobid

£可爱£侵袭症+ 提交于 2019-12-23 02:41:08

问题


Created controller and tried to access it by url got an error like 404 Error

The page you are looking for could not be found.

Try checking the URL for errors, then hit the refresh button on your browser.

Used the fallowing procedure

 //created route

 'app-test-index'         => array(
        'test',
        array(
            'controller' => 'test',
            'action'     => 'index',
        ),
    ),

//controller

 namespace App\Controller;

  use Ppb\Controller\Action\AbstractAction,
 Cube\Controller\Front,
 Cube\View,
 Cube\Validate\Url as UrlValidator,
 Cube\Controller\Request,
 Ppb\Service;


class Test extends AbstractAction
{
public function Index()
{
    die('ok');
}
public function test()
{
    die('ok');
}
}

How to create model view controller in PHPProbid

how to customize PHPProbid

Thanks


回答1:


How to create a controller in PHPPROBID version 7.8

Step 1: Create a controller file in corresponding module

step 2: Edit the model Acl file in corresponding module

for example

a) Create a controller Test.php in module/App/src/App/Controller.

b) Add resources (Give permissions to user roles for the created controller) in

module/App/src/App/Model/Acl.php file

In our case you need to add the following lines

$test = new Permissions\Resource('Test');
$this->addResource($test);
$this->allow('Guest', 'Test');

It is important to note that the module/App/src/App/Model/Acl.php file will be replaced during phpprobid update so you need to create a folder named mods in root(IF already exist no need to create). Copy the file to mods folder with corresponding folder structure In our example copy Acl.php to mods/module/App/src/App/Model folder.

Now you can access your controller

http://your_domain.com/index.php?module=app&controller=test&action=index



来源:https://stackoverflow.com/questions/33124150/creating-controller-error-in-phpprobid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!