dragam0217 2011-05-01 17:55
浏览 23
已采纳

pyrocms:创建模块时在前端禁止访问

I am trying to create a simple module to test things out and whenever I go to the module page http://mysite.com/testmodule I get a "forbidden, access denied" error.

the only thing the module does is echo out a test string:

<?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';


}


}

Any idea why this might be happening?

  • 写回答

1条回答 默认 最新

  • duanqian2368 2011-05-02 14:59
    关注

    I'm not overly familiar with PyroCMS (as in, not at all) but it is based on Codeigniter... in which case, it seems likely that the following might help. Apologies if they are not appropriate for PyroCMS.

    Try it again like this:

        <?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';
        }
    }
    

    Your problems may be: 1) You were echoing in your constructor not in a default function 2) Your class name did not start with a capital letter

    Hope that helps!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CATIA有些零件打开直接单机确定终止
  • ¥15 请问有会的吗,用MATLAB做
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 ARIMA模型时间序列预测用pathon解决
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序,怎么查看客户esp32板子上程序及烧录地址