在我的 PHP中的每一个
文件,我需要做的:
In every single one of my php
files I have to do:
<?php require_once('file.php'); ?>
我一直在做一个谷歌研究,发现我可以使用的.htaccess
追加或prePEND任何PHP文件或者我需要的任何其他文件我的每一个其他文件是这样的:
I've been doing a Google research and found that I could use the .htaccess
to append or prepend any php file or any other files I need in each of my other files like this:
php_value auto_prepend_file "/real/path/to/file/file.php"
php_value auto_append_file "/real/path/to/file/file.php"
我是新手,还没有发挥各地太多的的.htaccess
。另外,我阅读了的.htaccess
搞乱可以肆虐到我的网站,我还没有尝试过了。
I'm a novice and have not yet played around too much with the .htaccess
. Also, I've read that messing with .htaccess
can wreak havoc to my website, I haven't tried it out.
在这里我的问题是这样的。我也有我的应用程序jQuery的文件,如果的.htaccess
将要追加/ prePEND的为file.php
中的每一个文件,甚至没有尝试它,我知道这是怎么回事,包括我的样式,我的日志文件等有没有办法使排除的文件,我不想让文件。 PHP
来追加/ prepended?
My question here is this. I also have jQuery files in my application, if the .htaccess
is going to append/prepend the file.php
in each and every file, without even trying it out I know it's going to include my stylesheets, my log files, etc. Is there a way make exclusions to files where I don't want file.php
to be appended/prepended?
可以在特定的文件夹禁用它。 How我可以禁用AUTO_ prePEND特定文件夹中使用htaccess的?
you can disable it in specific folders. How can I disable auto_prepend in specific folders using htaccess?
如果您希望有条件地禁止它在某些文件,你可以在你的append.php条件语句它不会回不管它是什么,它一般不会,如果文件名匹配特定的条件
您可以使用 __ 文件的__
指令来获取当前文件,你可以有一个条件检查
If you want to conditionally disable it in certain files, you can have a conditional statement in your append.php where it doesn't echo whatever it is that it normally does, if the filename matches a certain condition
You can use __FILE__
directive to get the current file, and you can have a condition check
<?php
if(__FILE__!="..yourfile..")
{
?>
<link rel="stylesheet" href="...">
...
<?php
}
?>
等