php Laravel 基本路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14631436/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
laravel base path
提问by ebelendez
Im using URL::base(); and I get this URL:
我使用 URL::base(); 我得到这个网址:
http://www.kp.com.mx/sis_colgate/public
but what I need is this complete path:
但我需要的是这个完整的路径:
/home/belendez/public_html/sis_colgate/public
Does anybody knows how can I get that path? Thanks
有谁知道我怎样才能得到那条路?谢谢
回答by Deinumite
What you want to use is the pathhelper.
您要使用的是path助手。
The URL helper is for generating HTTP URLs.
URL 助手用于生成 HTTP URL。
Try the path('public')function in Laravel 3,
试试path('public')Laravel 3 中的功能,
or the public_path()function in Laravel 4.
或public_path()Laravel 4 中的函数。
Edit: Updated with answer for Laravel 4, thanks Erin
编辑:更新了 Laravel 4 的答案,感谢 Erin

