confused when using createController and render

<<<<Yii 2.0>>>>

in vendor/yiisoft/yii2/Yii.php ,I add a function like




    static private function mytest(){


        $cc = Yii::$app->createController('site/show');

        $cc[0]->runAction('show');


        //cc[0]->runAction('show')->render("/site/show");

        //$cc[0]->render("/site/show");


    }



while in frontend/controllers/SiteContoller.php,action is such defined




        public function actionShow(){

                return $this->render('show');

        }



and in frontend/themes/default/site/show.php,it,s just,




<?php echo "ssssssss";?>



question is ,when call,Yii::mytest,i just got a white page with nothing on it!

is there anything wrong on the function mytest()??

#######fixing########

sorry i cut some code for short,in fact,mytest is a public func

and is calling a private one named show():




    static private function show(){


        $cc = Yii::$app->createController('site/show');

        $cc[0]->runAction('show');


        //cc[0]->runAction('show')->render("/site/show");

        //$cc[0]->render("/site/show");


    }

//

    static function mytest(){

        self::show();

    }

// i think problem is here

$cc = Yii::$app->createController('site/show');

        $cc[0]->runAction('show');



I guess this would turn into an error since your mytest is a private method you would not be able to call it

+1

It should be a public method.

@lagogz thank you

hit +1 on the comment itself if you like … hehe

sorry,i miss some code ,new question is fiexed up there,my you reread it ~~~

i changed the post,may you reread it

It wasn’t the solution :(