Kohana 3.2 PHP5控制器动作没有调用

时间:2022-10-13 13:14:20

Newbie here trying to maintain a PHP website for some charity organization, but cannot get a controller action to invoke:

新手在这里试图维护一个慈善组织的PHP网站,但无法获得控制器动作来调用:

Under /application/classes/controller,

在/ application / classes / controller下,

I have a file called history.php. Content of this file looks like this:

我有一个名为history.php的文件。此文件的内容如下所示:

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_History extends Controller_Template {

    public function action_index()
    {   
        $this->response->body('hello, world!');     
    }       
} 

When I go to mydomain.com/history, I get error 404 indicating The requested URL /history was not found on this server.

当我去mydomain.com/history时,我收到错误404,表示在此服务器上找不到请求的URL /历史记录。

Boostrap.php has the following default routes defined:

Boostrap.php定义了以下默认路由:

Route::set('welcome-message1', 'directors-welcome-message')
    ->defaults(array(
        'controller' => 'welcome',
        'action'     => 'messageDirector',
    ));

Route::set('welcome-message2', 'directoress-welcome-message')
    ->defaults(array(
        'controller' => 'welcome',
        'action'     => 'messageDirectoress',
    ));

Route::set('default', '(<controller>(/<action>(/<id>)))')
    ->defaults(array(
        'controller' => 'welcome',
        'action'     => 'index',
    ));

/application/logs/2012/06 contains no errors.

/ application / logs / 2012/06没有错误。

Can someone please give me a pointer?

有人可以给我一个指针吗?

1 个解决方案

#1


1  

Is it a kohana error or an apache (web server) error? Do you have htaccess enabled? Try /index.php/history.

是kohana错误还是apache(web服务器)错误?你有启用htaccess吗?试试/index.php/history。

#1


1  

Is it a kohana error or an apache (web server) error? Do you have htaccess enabled? Try /index.php/history.

是kohana错误还是apache(web服务器)错误?你有启用htaccess吗?试试/index.php/history。