我正在尝试创建一个简单的模块来测试,每当我进入模块页面http://mysite.com/testmodule时,我都会收到“禁止访问被拒绝”错误。
模块唯一能做的就是回显测试字符串:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class testmodule extends Public_Controller
{
/**
* Constructor method
*
* @author PyroCMS Dev Team
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
echo 'test';
}
}
知道为什么会这样吗?
答案 0 :(得分:1)
我对PyroCMS并不过分熟悉(例如,根本不熟悉),但它基于Codeigniter ...... 在这种情况下,似乎以下可能会有所帮助。如果它们不适合PyroCMS,请道歉。
再试一次:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Testmodule extends Public_Controller
{
/**
* Constructor method
*
* @author PyroCMS Dev Team
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
}
public function index()
{
echo 'Test';
}
}
您的问题可能是: 1)您在构造函数中回显而不是在默认函数中 2)您的班级名称不是以大写字母开头
希望有所帮助!