在phpprobid中创建控制器错误 [英] Creating controller error in phpprobid
问题描述
创建的控制器并尝试通过url访问它时出现错误,如404错误
找不到您要寻找的网页。
尝试检查网址是否有错误,然后点击浏览器上的刷新按钮。
使用暂停过程
//创建路由
'app-test-index'=> array(
'test',
array(
'controller'=>'test',
'action'=>'index',
)
),
// controller
命名空间App\Controller;
使用Ppb \Controller\Action\AbstractAction,
Cube\Controller\Front,
Cube\View,
Cube\Validate\\ \\ Url as UrlValidator,
Cube\Controller\Request,
Ppb\Service;
类测试extends AbstractAction
{
public function Index()
{
die('ok');
}
public function test()
{
die('ok');
}
}
如何在PHPProbid中创建模型视图控制器
如何自定义PHPProbid
感谢
如何使用PHPPROBID版本7.8创建控制器
步骤1:在相应模块中创建控制器文件
步骤2:在相应的模块中编辑模型Acl文件
例如
a)在模块/ App / src / App / Controller中创建一个控制器Test.php。
b)添加资源对于创建的控制器)中
模块/ App / src / App / Model / Acl.php文件
在我们的例子中,您需要添加以下行: $ test = new Permissions\Resource('Test');
$ this-> addResource($ test);
$ this-> allow('Guest','Test');
这是重要要注意的模块/ App / src / App /Model/Acl.php文件将在phpprobid更新
期间被替换,因此您需要在根目录中创建一个名为mods的文件夹(如果已经存在,则不需要创建)。
将文件复制到具有相应文件夹结构的mods文件夹
在我们的示例中,将Acl.php复制到mods / module / App / src / App / Model文件夹。
现在您可以访问您的控制器了。
http://your_domain.com/index.php?module=app&controller=test&action=index
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
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
这篇关于在phpprobid中创建控制器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!