我想从"/account/admin/index" 字符串中获得module=account controller=admin action=index 不知道有没这样功能的函数 翻遍了urlmanager和cwebapplication好像没有类似的功能(如果没有的话只能自己造一个轮子了)
我想从"/account/admin/index" 字符串中获得module=account controller=admin action=index 不知道有没这样功能的函数 翻遍了urlmanager和cwebapplication好像没有类似的功能(如果没有的话只能自己造一个轮子了)
可以用explode把这个字符串分割一下。
<?php
$str = '/account/admin/index';
$str = explode('/',ltrim($str,'/'));
echo 'module='.$str[0];
echo 'controller='.$str[1];
echo 'action='.$str[2];
?>
如果URL是Yii的网站的 可以直接用类似 $this->controller->id 这样获得的,我记得。。
楼上说的没错,不过我没太明白楼主的意图。
舰长看来就是我们2关心哈。 lz已经跑路了。