chore(debug): 临时路由诊断探针 /api/probe/index

这个提交包含在:
linda
2026-10-15 14:41:15 +08:00
父节点 c0c6d214b2
当前提交 f50194c83b

查看文件

@@ -0,0 +1,48 @@
<?php
namespace app\api\controller;
use think\Config;
use think\Route;
/**
* 路由诊断探针(临时,验证完成后删除)
* 访问:GET /api/probe/index
*/
class Probe extends \app\common\controller\Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
public function index()
{
$rules = Route::getRules();
$getBucket = isset($rules['get']) ? $rules['get'] : [];
$starBucket = isset($rules['*']) ? $rules['*'] : [];
$out = [
'request_path' => $this->request->path(),
'request_pathinfo' => $this->request->pathinfo(),
'request_module' => $this->request->module(),
'request_controller' => $this->request->controller(),
'request_action' => $this->request->action(),
'server_PATH_INFO' => isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : null,
'get_s' => isset($_GET['s']) ? $_GET['s'] : null,
'url_route_on' => Config::get('url_route_on'),
'route_config_file' => Config::get('route_config_file'),
'pathinfo_depr' => Config::get('pathinfo_depr'),
'CONF_PATH' => CONF_PATH,
'route_file_exists' => is_file(CONF_PATH . 'route.php'),
'runtime_route_file' => is_file(RUNTIME_PATH . 'route.php'),
'rule_buckets' => array_keys($rules),
'get_bucket_count' => count($getBucket),
'star_bucket_count' => count($starBucket),
'get_sample' => array_slice(array_keys($getBucket), 0, 8),
'has_static_rule' => isset($getBucket['api/v1/home/banners']),
'star_has_static' => isset($starBucket['api/v1/home/banners']),
];
echo json_encode($out, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
exit;
}
}