我想找到字符串的子字符串或使用Twig检查是否没有这样的子字符串.换句话说,我需要在php中使用'strstr'或'strpos'的模拟.我用Google搜索并在stackoverflow中搜索了这个问题,但没有找到.有人知道如何解决这个问题吗?
我的网址如http://MYDOMAIN.com/cron/reports/test?code=f463529c1b75f4d868.我需要检索代码(f463529c1b75f4d868).我该怎么办?(我在Kohana工作)我有这样的路线:
Route::set('cron_defaults', 'cron/<controller>(/<action>(?code=<code>))')
->defaults(array(
'directory' => 'cron',
'controller' => 'reports',
'action' => 'test',
));
Run Code Online (Sandbox Code Playgroud)
在我写的控制器报告中:
var_dump(Request::instance()->param('code'));
Run Code Online (Sandbox Code Playgroud)
我的结果是NULL.怎么了?