Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP获取显示错误文档样式的路径_Php_Apache_.htaccess_Path_Errordocument - Fatal编程技术网

使用PHP获取显示错误文档样式的路径

使用PHP获取显示错误文档样式的路径,php,apache,.htaccess,path,errordocument,Php,Apache,.htaccess,Path,Errordocument,我在Apache2.4.18和PHP5.5.35中使用XAMPP 我有一个.htaccess用于每个客户的部门文件夹(如我所述),其中的代码是: Options -Indexes Options +FollowSymlinks Options -MultiViews RewriteEngine on RewriteBase / ErrorDocument 404 /clientName/workDivision1/errors/404.php workDivision2和workDivisi

我在Apache2.4.18和PHP5.5.35中使用XAMPP

我有一个
.htaccess
用于每个客户的部门文件夹(如我所述),其中的代码是:

Options -Indexes
Options +FollowSymlinks
Options -MultiViews
RewriteEngine on
RewriteBase /

ErrorDocument 404 /clientName/workDivision1/errors/404.php
workDivision2和workDivision3也一样

当我试图为样式和脚本设置路径时,问题就出现了。 如果我在“404.php”文件中这样做

但如果它是由

clientName.domain/workDivision1
clientName.domain/workDivision1/folder/index.php
那么样式的路径就不再正确了

用PHP有解决这个问题的方法吗?有没有不安全的东西? 我试图避免在这些链接中放置特定/固定/定义的URL


dirname(\uuuuu FILE\uuuuu)
对我不起作用,因为这样做:

<link href="<? echo dirname(__FILE__); ?>/css/general.css" type="text/css" rel="stylesheet">
所以它找不到文件

<link href="<? echo dirname(__FILE__); ?>/css/general.css" type="text/css" rel="stylesheet">
<link href="/Applications/XAMPP/xamppfiles/htdocs/clientName/workDivision1/errors/css/general.css" type="text/css" rel="stylesheet">
http://(MY LOCAL IP)/Applications/XAMPP/xamppfiles/htdocs/clientName/workDivision1/css/general.css