Forms 代码点火器4形成动作路径
很抱歉,我的问题很难说。我有一个页面:里面有表格Forms 代码点火器4形成动作路径,forms,codeigniter-4,Forms,Codeigniter 4,很抱歉,我的问题很难说。我有一个页面:里面有表格 <form class="" action="" method="post"> 路线 $routes->match(['get', 'post'], 'account/edit_game/(:num)', 'Addgame::edit_game/$1'); 有人可以提供建议吗?action=“是将表单数据发送到的URI,也称为处理接收到的数据的控制器。如果未指定,它
<form class="" action="" method="post">
路线
$routes->match(['get', 'post'], 'account/edit_game/(:num)', 'Addgame::edit_game/$1');
有人可以提供建议吗?action=“
是将表单数据发送到的URI,也称为处理接收到的数据的控制器。如果未指定,它将与您当前所在的页面相同
您可以做什么:
在最后一个示例中,请注意前导的/
,这意味着它根据站点根。如果您忘记了它,它将是相对于当前URI的
例如,如果包含
的页面是http://example.com/edit/3
:
将重定向到action=“/some/page”
http://example.com/some/page
将重定向到action=“some/page”
http://example.com/edit/some/page
$routes->setTranslateURIDashes(true)
在app/Config/Routes.php中,您可以在URL中使用破折号:site.com/account/edit game/3
=>account::edit_game(3)
(这个-
变成了一个
。谢谢您的建议。我试图将它设置为true,但它不起作用。
$routes->match(['get', 'post'], 'account/edit_game/(:num)', 'Addgame::edit_game/$1');