You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel Telescope菜单路径跳转异常问题配置指导

解决Laravel Telescope菜单跳转路径缺失项目子路径的问题

核心原因

Telescope的菜单链接依赖Laravel框架的URL生成机制,当项目部署在localhost的子路径下时,若.env中的APP_URL未配置完整的项目基础路径,路由生成会缺失子路径部分,导致跳转URL错误。

解决方案

1. 修正.env中的APP_URL

将APP_URL设置为项目的完整访问根路径,例如:

APP_URL=http://localhost/my-project/telescope-project/public

2. 清除配置缓存

修改.env后,执行命令清除配置缓存,确保新的APP_URL生效:

php artisan config:clear

3. 优化Telescope服务注册(可选)

你当前在AppServiceProvider中重复注册了两个Telescope服务提供者,可简化为仅注册自定义的提供者(若已发布Telescope配置,通常为App\Providers\TelescopeServiceProvider):

public function register(): void
{
    if ($this->app->environment('local')) {
        $this->app->register(\App\Providers\TelescopeServiceProvider::class);
    }
}

验证操作

重新访问Telescope仪表盘,点击菜单链接(如Commands、Requests),此时跳转URL应自动包含完整的项目子路径,例如http://localhost/my-project/telescope-project/public/telescope/requests。

内容的提问来源于stack exchange,提问作者Hemil

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 04:45:56