【发布时间】:2011-08-12 14:56:41
【问题描述】:
我正在尝试使用以下代码从 kohana 3 中的 url 获取参数,但是 fire bug 给了我一条错误消息“无效的正则表达式标志 n” 代码是:
控制器
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Test extends Controller_Template
{
public function action_index()
{
$this->template = View::factory('par');
$this->template->content = View::factory('par');
}
public function get()
{
$param1 = $this->request->param('param1');
$param2 = $this->request->param('param2');
$param3 = $this->request->param('param3');
echo "This is param1: ".$param1;
echo "This is param2: ".$param2;
echo "This is param3: ".$param3;
}
}
查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php $x=1;
$y=2;
$z=3;
?>
<input type="button" value = "button" onClick=<?php echo url::site('test/get'.$x);?> />
</body>
</html>
引导带
Route::set('default', '(<controller>(/<action>(/<param1>)(/<param2>)(/<param3>)))',
array(
'param1' => '\d+',
'param2' => '\d+',
'param3' => '\d+',
))
->defaults(array(
'controller' => 'test',
'action' => 'index',
));
请帮我解决这个问题。
【问题讨论】:
-
浏览器中不显示任何内容....只是在firebug中显示以下行:无效的正则表达式标志n [Break On This Error] /param/index.php/test/get1 还有我我正在尝试获取所有三个参数...请告诉我该怎么做