在此屏幕视频中:https://tutsplus.com/lesson/displaying-registered-routes/ Jeffrey Way演示了他创建的命令,并链接到描述中的github。然而有一个更新说现在它已经融入了Laravel 4核心,但是我已经找到了它,但无济于事。显示Laravel的注册路线
一般的想法是列出所有路线并将动作绑定到它们。
任何帮助,将不胜感激。
在此屏幕视频中:https://tutsplus.com/lesson/displaying-registered-routes/ Jeffrey Way演示了他创建的命令,并链接到描述中的github。然而有一个更新说现在它已经融入了Laravel 4核心,但是我已经找到了它,但无济于事。显示Laravel的注册路线
一般的想法是列出所有路线并将动作绑定到它们。
任何帮助,将不胜感激。
您可能仍在使用旧版本的L4测试版。如果您下载新副本,则在运行php artisan
时会看到列出的副本。
控制台命令:
php artisan routes (laravel 4)
php artisan route:list (laravel 5)
+--------+----------------------------------------------------+-----------------------+----------------------------------------------+--------------------------------------------------------------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters |
+--------+----------------------------------------------------+-----------------------+----------------------------------------------+--------------------------------------------------------------------+---------------+
| | GET /admin/configuration | | [email protected] | auth, keyMaster:configuration | |
| | POST /admin/configuration | | [email protected] | auth, keyMaster:configuration | |
| | GET /admin/logs/errors | | [email protected] | auth, keyMaster:logs/errors | |
| | GET /admin/logs/errors/{name} | | [email protected] | auth, keyMaster:logs/errors | |
| | DELETE /admin/logs/errors | | [email protected] | auth, keyMaster:logs/errors | |
| | GET /admin/logs/events | | [email protected] | auth, keyMaster:logs/events | |
| | GET /admin/logs/events/data | | [email protected] | auth, keyMaster:logs/events | |
等等
laravel 5.4这个答案仍然有效 – 2018-03-05 03:18:22
我创建了一个将列出一个html表中的每个路由及其相应的详细信息的途径。
Route::get('routes', function() {
$routeCollection = Route::getRoutes();
echo "<table style='width:100%'>";
echo "<tr>";
echo "<td width='10%'><h4>HTTP Method</h4></td>";
echo "<td width='10%'><h4>Route</h4></td>";
echo "<td width='80%'><h4>Corresponding Action</h4></td>";
echo "</tr>";
foreach ($routeCollection as $value) {
echo "<tr>";
echo "<td>" . $value->getMethods()[0] . "</td>";
echo "<td>" . $value->getPath() . "</td>";
echo "<td>" . $value->getActionName() . "</td>";
echo "</tr>";
}
echo "</table>";
});
我有一个页面,可以让我在laravel中运行一些代码,所以这是完美的。 – DoverAudio 2015-05-27 17:24:21
你的意思是'php工匠路线:list',不是吗? – algorhythm 2015-04-09 11:22:40
对于Lavarel 5和5+的命令是:
php artisan route:list
对于较低版本Lavarel(比Lavarel 5下),它将是:
php artisan routes
完美的感谢,我很喜欢从你的屏幕演员学习!你打算再做些什么,也许建立一个简单的博客,测试作为一个焦点或什么? – Jordan 2013-04-11 18:26:12
他拥有laracasts.com,内容惊人。 – wesside 2013-12-12 16:42:00
JeffreyWay自己回答了这个问题?我的天啊。 – 2018-03-05 03:31:31