- echo '<pre>';
- //CUrlManager::PATH_FORMAT = false;
- $urlManager = new CUrlManager();
- $refiectionClass = new ReflectionClass('CUrlManager');
- $reflectionProperty = $refiectionClass->getProperty('_urlFormat');
- $reflectionProperty->setAccessible(true);
- //设置get方式访问
- $reflectionProperty->setValue($urlManager, 'get');
- //获取普通url
- $url = $urlManager->createUrl('Index/index');
- //设置伪静态
- $reflectionProperty->setValue($urlManager, 'path');
- //获取伪静态模式url
- $url_rewrite = $urlManager->createUrl('Index/index');
- ///Yii::app()->urlManager->enableStrictParsing =false;
- echo 'common url: ',$url,'<br>';
- echo 'rewrite url:',$url_rewrite;

