1

これは私のコントローラファイル MyController.php

class MyController extends CController
{
    /**
     * Index action is the default action in a controller.
     */
    public function actionIndex()
    {
        $this->printtablerecord();
        $this->abc();
    }
    public function print(){
        echo "print";
    }
    public function abc(){
        echo "abc";

    }
    public function abc1(){
        echo "abc1";
    }

}

このファイル domain.com/mypage/index.php を実行すると、このコントローラーが呼び出されます。

しかし、domain.com/mypage/index.php/abc を実行したいのですが、404 が返されます。

URLでコントローラー機能を実行したい。

domain.com/mypage/index.php/mycontroller/functionname を実行すると

URLを使用して特定の機能を実行します。

urlManager を使用して main.php にルールを書き込む方法は?

これは私のconfig/main.phpです

'urlManager'=>array(
        'urlFormat'=>'path',
        'rules'=>array(
                'abc' => 'MyController/abc',
    ),
4

2 に答える 2