codeigniter 4路由命名路由不会产生href

问题描述 投票:0回答:1

我有一条应该为锚标签生成href的路线,但没有得到href:

<a href="" style="color:white !important" class="btn btn-info postlist">Update</a>

我上面的代码是:

data[i]["confirm"] = '<a href="<?=route_to('updatePost', 1) ?>" style="color:white !important" class="btn btn-info postlist">Update</a>';

我的路线是:

//$routes->add('post/(:id)', 'App/Controllers/Post::updatepost/$1');
$routes->add('post/(:id)', 'Post::updatepost/$1', ['as' => 'updatePost']);

我期望有类似this的内容>

注:尝试使用未命名和命名的方式都没有产生任何href

我有一条应该为锚标签生成href的路由,但没有得到href:Update我的代码...

routes href codeigniter-4 named-routing
1个回答
0
投票

简短的答案是(:id)不被支持。

© www.soinside.com 2019 - 2024. All rights reserved.