我正在使用XAMPP,并在 C:\ xampp \ htdocs \ larascopy create-project --prefer-dist laravel / laravel larascopy 的新Laravel 5.8 >
我可以通过以下方式访问它: http://localhost/larascopy/public/
然后使用《指南》中的以下命令安装Telescope:
composer require laravel/telescope
php artisan telescope:install
php artisan migrate
然后我可以像这样打开望远镜 http://localhost/larascopy/public/telescope
但是所有链接都是错误的!他们指向: http://localhost/telescope/ ...
所以我在控制台中收到所有这些错误。
POST http://localhost/telescope/telescope-api/commands?tag=&before=&take=50&family_hash= 404 (Not Found)
POST http://localhost/telescope/telescope-api/commands?tag=&before=&take=50&family_hash= 404 (Not Found)
POST http://localhost/telescope/telescope-api/schedule?tag=&before=&take=50&family_hash= 404 (Not Found)
app.js?id=8776cf12ba6d7c72f145:1 Uncaught (in promise) Error: Request failed with status code 404
有没有办法告诉望远镜正确的路径?
答案 0 :(得分:2)
您需要通过覆盖望远镜的布局更改望远镜的路径,为此,您需要执行以下步骤。
此解决方案也适用于在中创建的望远镜laravel项目 子文件夹。
步骤1:从以下路径复制布局文件
文件路径: project_directory /vendor/laravel/telescope/resources/views/layout.blade.php
步骤2:将复制的文件粘贴到以下路径
文件路径: project_directory /resources/views/vendor/telescope/layout.blade.php
您需要在资源/视图中创建vendor / telescope文件夹 目录。
第3步:更改layout.blade.php文件
文件路径: project_directory /resources/views/vendor/telescope/layout.blade.php
原文:
package main
import (
"math/rand"
"log"
"os"
"os/signal"
//"runtime"
"time"
)
func main() {
log.Println("---start---")
defer log.Println("---end---")
rand.Seed(time.Now().Unix())
go func() {
m := make(map[string]string)
for {
for i := 0; i < 1000000; i++ {
k := randString(64)
m[k] = randString(1024 * 1024)
}
for k, _ := range m {
delete(m, k)
}
//runtime.GC()
}
}()
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, os.Interrupt)
for {
select {
case <- sigs:
log.Println("---Ctrl C recived---")
return
}
}
}
func randString(n int) string {
const letters = "0123456789abcdefgkhijklmnopqrstuvwxyz"
b := make([]byte, n)
for i := 0; i < n; i++ {
b[i] = letters[rand.Int63() % int64(len(letters))]
}
return string(b)
}
已更新:
<!-- Global Telescope Object -->
<script>
window.Telescope = @json($telescopeScriptVariables);
</script>
答案 1 :(得分:1)
我终于找到了解决方案(针对可能遇到此问题的其他人)。
<!-- Global Telescope Object -->
<script>
window.Telescope = @json($telescopeScriptVariables);
</script>
对此
<!-- Global Telescope Object -->
<script>
window.Telescope = @json($telescopeScriptVariables);
window.Telescope.path = 'your_project_folder/public/telescope';
</script>
答案 2 :(得分:1)
好吧,直接在视图内部覆盖超全局配置不是正确的方法:
通过将其写入项目的根文件夹中的.env文件,您可以更正确地完成相同的操作:
TELESCOPE_PATH=yourSubFolder/telescope
然后在您的视图中config('telescope.path')将返回yourSubFolder / telescope
修改供应商的视图可能会在您的项目投入生产时引起问题:供应商将由作曲家重新加载到最新版本,并且您的修改将被删除。
.env文件不会。
但是无论如何,这根本无法为我调试望远镜:
我能够在localhost / myproject / public / myproject / public / telescope上加载Telescope。所有链接都很好:localhost / myproject / public / telescope / queries,localhost / myproject / public / telescope / requests等... 但是望远镜仍然没有加载数据。
要完全调试,我尝试配置Apache并为项目创建VirtualHost。 然后,Telescope完全致力于http://myproject.local/telescope