解析php包括(也包含php代码) - 或“Reparsing” php文件 [英] Parsing a php include (which also contains php code) - or "Reparsing" the php file

查看:61
本文介绍了解析php包括(也包含php代码) - 或“Reparsing” php文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我在我的网站上使用<?php include()?语句来构建

组织目的。但是,我的一个包含一些

PHP代码。有没有办法让服务器实际解析

包含?我之前尝试过这个,并没有解析包含。

相反,它包含的文件只是普通的ASCII。

======= ================

/ *例1 * /

/*index.php*/

....

<?php include(''global / includes / footer.inc'')?>

....


/*footer.inc*/

....

< p>& copy 1993-<?php回音日期(Y)?Kingswood School。所有权利

保留。< / p>

....


/ *示例2 * /

/*index.php*/

....

<?php include(''global / includes / lastmod.php'') ?>

....


/*lastmod.php*/

....

<?php

echo"此文件最后修改时间:" ;;

echo strftime("%A%B%d%Y" );

include(''whateverfilename.inc'');

?>


====== =======================


在某些情况下,创建嵌套包含(包含在

中)。这甚至可能吗?任何想法?


任何帮助肯定是值得赞赏的。谢谢!


Steven Borrelli

网络开发者

Kingswood学校

解决方案

Steven Borrelli写道:


您好,


我正在使用< ;?php include()?声明在我的网站上为

组织目的。但是,我的一个包含一些

PHP代码。有没有办法让服务器实际解析

包含?我以前尝试过这个,它没有解析include。

相反,它包含的文件只是普通的ASCII。



如果主页面是php文件,include也会使包含的页面由php解析为


我建议你在每个命令之后使用分号,不管它是否单独

之间的php-tags。

它是'总是更好地使用.php作为包含文件的文件扩展名

,这个.inc通常不会被设置在要解析的服务器中,这就是

导致如果一个人给出和网址如

http:/ /example.net/footer.inc


他们会看到完整的来源,如果你碰巧拥有你的数据库

登录/密码存储在文件中,然后他们将知道如何访问它。

如果你还没有,那么运行apache web服务器并避免发布是非常好的。
< br $>
-


// Aho


文章< 11 ****** **** ************@q75g2000hsh.googlegroups .com> ;,

Steven Borrelli< sb ******** @ gmail.comwrote:


您好,


我在我的网站上使用<?php include()?语句

组织目的。但是,我的一个包含一些

PHP代码。有没有办法让服务器实际解析

包含?我之前尝试过这个,并没有解析包含。

相反,它包含的文件只是普通的ASCII。

======= ================

/ *例1 * /

/*index.php*/

...

<?php include(''global / includes / footer.inc'')?>

...


/*footer.inc*/

...

< p>& copy 1993-<?php echo date( Y)?Kingswood School。所有权利

保留。< / p>

...


/ *示例2 * /

/*index.php*/

...

<?php include(''global / includes / lastmod.php'')?> ;

...

/*lastmod.php*/

...

<?php

echo"此文件最后修改时间:" ;;

echo strftime("%A%B%d%Y");

include(''whateverfilename.inc'');

?>


========== ===================


在某些情况下,创建嵌套包含(包含在

中)。这甚至可能吗?任何想法?


任何帮助肯定是值得赞赏的。谢谢!


Steven Borrelli

网络开发者

Kingswood学校



只要包含文件具有< ;?b就应该解析和?标签。

我的大部分内容都标记为.inc并且工作正常。


Tim Streater写道:


文章< 11 ********************** @ q75g2000hsh.googlegroups .com>,

Steven Borrelli< sb ******** @ gmail.comwrote:


>你好,

我我在我的网站上使用<?php include()?语句来组织
。但是,我的其中一个包含一些
PHP代码。有没有办法让服务器实际解析
包含?我之前尝试过这个,它没有解析包含。
相反,它包含的文件只是普通的ASCII。
=============== ========
/ *示例1 * /
/*index.php*/
...
<?php include(''global /包括/ footer.inc'')?>
...

/*footer.inc*/
...
< p>&复制1993-<?php echo date(Y)?Kingswood School。所有权利
保留。< / p>
...

/ *示例2 * /
/*index.php*/
。 ..
<?php include(''global / includes / lastmod.php'')?>
...

/*lastmod.php * /
...
<?php
echo"此文件最后被修改:" ;;
echo strftime("%A%B%d%Y");
include(''whateverfilename.inc'');
?>

==================== =========

我希望能够解析包含它的PHP代码,并且在某些情况下,创建嵌套包含(包括在内
包括)。这甚至可能吗?有什么想法吗?

任何帮助肯定是值得赞赏的。谢谢!

Steven Borrelli
Web开发人员
Kingswood学校



只要包含文件包含,就应该解析<?和?标签。

我的大多数包含都标记为.inc并且工作正常。



这完全取决于你的网络服务器的设置方式。


但.php文件应由每个网络服务器解析安装了php。


-

==================

删除x来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================


Hello,

I am using the <?php include() ?statement on my website for
organizational purposes. However, one of my includes contains some
PHP code. Is there any way for the server to actually parse the
include? I''ve tried this before, and it did not parse the include.
Rather, it included the file as just plain ASCII.
=======================
/*EXAMPLE 1*/
/*index.php*/
....
<?php include(''global/includes/footer.inc'') ?>
....

/*footer.inc*/
....
<p>&copy 1993-<?php echo date("Y") ?Kingswood School. All rights
reserved.</p>
....

/*EXAMPLE 2*/
/*index.php*/
....
<?php include(''global/includes/lastmod.php'') ?>
....

/*lastmod.php*/
....
<?php
echo "This file was last modified: ";
echo strftime("%A %B %d %Y");
include(''whateverfilename.inc'');
?>

=============================

I would like to be able to parse the include if it has php code, and
in some cases, create nesting includes (an include within an
include). Is this even possible? Any ideas?

Any help is certainly appreciated. Thanks!

Steven Borrelli
Web Developer
Kingswood School

解决方案

Steven Borrelli wrote:

Hello,

I am using the <?php include() ?statement on my website for
organizational purposes. However, one of my includes contains some
PHP code. Is there any way for the server to actually parse the
include? I''ve tried this before, and it did not parse the include.
Rather, it included the file as just plain ASCII.

If the main page is a php file, include will also make the included page to be
parsed by php.
I do suggest you use semicolon after each command, no matter if it''s alone
between the php-tags or not.
It''s always better to use .php as the file extension on the included files
too, this as .inc normally don''t be set in the server to be parsed, which
leads to that if a person gives and url like

http://example.net/footer.inc

they will see the full source, and if you happen to have your database
login/password stored in the file, then they will know how to access it.
If you don''t already, it''s quite good to run apache web server and avoid iss.

--

//Aho


In article <11**********************@q75g2000hsh.googlegroups .com>,
Steven Borrelli <sb********@gmail.comwrote:

Hello,

I am using the <?php include() ?statement on my website for
organizational purposes. However, one of my includes contains some
PHP code. Is there any way for the server to actually parse the
include? I''ve tried this before, and it did not parse the include.
Rather, it included the file as just plain ASCII.
=======================
/*EXAMPLE 1*/
/*index.php*/
...
<?php include(''global/includes/footer.inc'') ?>
...

/*footer.inc*/
...
<p>&copy 1993-<?php echo date("Y") ?Kingswood School. All rights
reserved.</p>
...

/*EXAMPLE 2*/
/*index.php*/
...
<?php include(''global/includes/lastmod.php'') ?>
...

/*lastmod.php*/
...
<?php
echo "This file was last modified: ";
echo strftime("%A %B %d %Y");
include(''whateverfilename.inc'');
?>

=============================

I would like to be able to parse the include if it has php code, and
in some cases, create nesting includes (an include within an
include). Is this even possible? Any ideas?

Any help is certainly appreciated. Thanks!

Steven Borrelli
Web Developer
Kingswood School

Should be parsed as long as the include file has the <? and ?tags.
Most of my includes are tagged .inc and it works fine.


Tim Streater wrote:

In article <11**********************@q75g2000hsh.googlegroups .com>,
Steven Borrelli <sb********@gmail.comwrote:

>Hello,

I am using the <?php include() ?statement on my website for
organizational purposes. However, one of my includes contains some
PHP code. Is there any way for the server to actually parse the
include? I''ve tried this before, and it did not parse the include.
Rather, it included the file as just plain ASCII.
=======================
/*EXAMPLE 1*/
/*index.php*/
...
<?php include(''global/includes/footer.inc'') ?>
...

/*footer.inc*/
...
<p>&copy 1993-<?php echo date("Y") ?Kingswood School. All rights
reserved.</p>
...

/*EXAMPLE 2*/
/*index.php*/
...
<?php include(''global/includes/lastmod.php'') ?>
...

/*lastmod.php*/
...
<?php
echo "This file was last modified: ";
echo strftime("%A %B %d %Y");
include(''whateverfilename.inc'');
?>

=============================

I would like to be able to parse the include if it has php code, and
in some cases, create nesting includes (an include within an
include). Is this even possible? Any ideas?

Any help is certainly appreciated. Thanks!

Steven Borrelli
Web Developer
Kingswood School


Should be parsed as long as the include file has the <? and ?tags.
Most of my includes are tagged .inc and it works fine.

It depends completely on how your webserver is set up.

But .php files should be parsed by every webserver which has php installed.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


这篇关于解析php包括(也包含php代码) - 或“Reparsing” php文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆