<?php

namespace App\Http\Controllers;

class HelloController extends Controller
{
public function index()
{
// 当前path
$router = explode("?", $request->getRequestUri())[0];
// 所有的router
$rts = app()->getRoutes();
// 当前route---做seo定制url时这个方法很有用
$routeInfo = app('request')->route();
$rows = [];
foreach ($rts as $rt => $route ) {
$rows[$route['uri']] = [
'verb' => $route['method'],
'uri' => $route['uri'],
'uses' => isset($route['action']['uses']) ? $route['action']['uses'] : 'Closure',
'controller' => $this->getController($route['action']),
'action' => $thiw->getAction($route['action']),
];
} print_r($rows);
return;
} /**
* @param array $action
* @return mixed|string
*/
protected function getAction(array $action)
{
if (!empty($action['uses'])) {
$data = $action['uses'];
if (($pos = strpos($data, "@")) !== false) {
return substr($data, $pos + 1);
} else {
return "METHOD NOT FOUND";
}
} else {
return 'Closure';
}
} /**
* @param array $action
* @return mixed|string
*/
protected function getController(array $action)
{
if (empty($action['uses'])) {
return 'Closure';
} return current(explode("@", $action['uses']));
} }

最新文章

  1. 如何刷新DNS缓存
  2. maven项目下jsp文件中el表达式失效问题
  3. Codeforces Round #345 D. Image Preview(二分)
  4. [3D跑酷] MissionManager
  5. Js document.frmLogin.action = &#39;/login.htm&#39;;的意义和form表单的target属性
  6. Android 轻量级ORM数据库开源框架ActiveAndroid 源码分析
  7. Requirements of children
  8. codecomb 2086【滑板鞋】
  9. Windows phone 8 学习笔记(2) 数据文件操作
  10. 学习axios
  11. Django中怎么做图片上传--图片展示
  12. Ubuntu 安装 OpenMPI
  13. C# 获取文件名及扩展名【转】
  14. iOS变量定义在 .h 还是 .m 中
  15. vue学习之node.js
  16. 学号20155308 2016-2017-2 《Java程序设计》第5周学习总结
  17. 机器学习(6): 层次聚类 hierarchical clustering
  18. HEVC 有损优化一
  19. RegExp使用技巧
  20. 网页实现插入图片—css与html的区别

热门文章

  1. vue.js中父组件触发子组件中的方法
  2. jQuery获取上传文件的名称
  3. springboot同时支持访问html5和jsp时,导致后台ResponseBody返回中文乱码
  4. html z-index
  5. Windows全屏代码--摘自Chrome
  6. Mac下Eclipse(Oxygen)添加Tomcat插件
  7. 数据结构实验之链表七:单链表中重复元素的删除(SDUT 2122)
  8. 无法连接虚拟设备 ide1:0及上不网
  9. node.js由浅入深教程
  10. 在Windows下安装scrapy