htaccess的帮助PHP文件

编程入门 行业动态 更新时间:2024-10-24 06:36:54
本文介绍了htaccess的帮助PHP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有很多的网页我的问题表示,我需要打开我的所有PHP文件,并在每个PHP页面的顶部添加一行code。

I have many pages my problem stands that I need to open all my php files and add a line of code at the top of each php page.

<?php if(!defined('no_d_a')){die('What The ... how did you get here :) ');} /* no direct access */ // rest of existing code here // ?>

问题是,我可以代替做到这一点的.htaccess文件,因为我感觉升技懒惰:)

Question is can I instead do this on a .htaccess file because I am feeling abit lazy :)

TIA

推荐答案

我觉得你的希望是一种prePEND与htaccess的文件?如果是的话这里亚去:

I think what your wanting is a way to prepend the files with htaccess? If so here ya go:

另存为prepend.php

Save this as 'prepend.php'

<?php if(!defined('no_d_a')){} /* no direct access */ ?>

在你的.htaccess添加:

in your .htaccess add:

<FilesMatch "\.(php)$"> php_value auto_prepend_file "/home/*******/public_html/prepend.php" </FilesMatch>

将prePEND与'prepend.php

it will prepend all .php files with 'prepend.php'

您可能需要有一些条件子句..但应该让你开始。

You may want to have some conditional clauses.. but that should get you started..

您还可以追加,而不是AUTO_ prepend_file

You can also append files with 'auto_append_file' instead of 'auto_prepend_file'

更多推荐

htaccess的帮助PHP文件

本文发布于:2023-10-31 16:32:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546645.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   htaccess   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!