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 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起