简体   繁体   English

如何使用php访问htdocs之外的文件夹

[英]how to access folder outside of htdocs with php

i have program, the log file address like that 我有程序,像这样的日志文件地址

C:\\Users\\Administrator\\AppData\\Roaming\\program-folder\\Logs C:\\ Users \\ Administrator \\ AppData \\ Roaming \\ program-folder \\ Logs

and now i want read this log file (text) with php how can assign address to open this file? 现在我想用php读取此日志文件(文本),如何分配地址以打开此文件?

PHP run by Apache cannot access files outside of the site root for obvious security reasons. 出于明显的安全原因,由Apache运行的PHP无法访问站点根目录之外的文件。 If you can't move the log file, you could look to use a symlink to make it accessible. 如果您无法移动日志文件,则可以使用符号链接使其可访问。

Based on the path you've given I'm assuming you're using Windows. 根据您给出的路径,我假设您正在使用Windows。 Here's a guide to symbolic links in Windows . 这是Windows中符号链接的指南。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM