douan6815
2009-07-24 16:22
浏览 34
已采纳

LAMP:为特定目录设置文档根目录

So I must upload the CMS that I've been creating in the development environment to my company's server to show the client. But the software I created was built in the document root, and the company wants me to upload it to a folder on the server. Is there any way to set the document root dynamically with PHP, or to include an .htaccess or some such thing in a single folder on a server?

I suppose I could also juse create some global var with

$DOCUMENT_ROOT = dirname(dirname(__FILE__)));

And reference that at the beginning of my paths, but I am looking for a more elegant solution.

图片转代码服务由CSDN问答提供 功能建议

所以我必须将我在开发环境中创建的CMS上传到我公司的服务器以显示客户端 。 但我创建的软件是在文档根目录中构建的,公司希望我将其上传到服务器上的文件夹中。 有没有办法用PHP动态设置文档根目录,或者在服务器上的单个文件夹中包含.htaccess或类似的东西?

我想我也可以创建一些 global var with

  $ DOCUMENT_ROOT = dirname(dirname(__ FILE __))); 
   
 
 

并参考at 我的路径的开头,但我正在寻找一个更优雅的解决方案。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题