如题,关于service文件中为什么要设置protected的action方法,而不是直接使用public的普通方法。
例如有如下service
<?php
namespace fecshop\services;
class Test extends Service
{
protected function actionHello(){
return 'world';
}
}
使用的时候需要这样调用
Yii::$service->test->hello();
那为什么,不直接将actionHello方法改为
public function hello(){
return 'world';
}
请问,这两种写法具体有哪些区别,有哪些影响?