为什么包含文件文本需要被<?php>括起来? ......<?> [英] Why does include file text need to be bracketed by <?php> ... <?>

查看:61
本文介绍了为什么包含文件文本需要被<?php>括起来? ......<?>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于在PHP脚本中调用include函数,为什么

包含的文件必须再次通过

将其自身标识为& ;?php ...<?>


人们会认为PHP解释器的工作原理与其他任何一种一样,

是,它首先扩展所有包含文件,然后解析

结果文本。任何人都可以帮忙解释一下吗?


谢谢,

M.麦克唐纳

Since the include function is called from within a PHP script, why
does the included file have to identify itself as a PHP again by
enclosing its code in <?php... <?>

One would assume that the PHP interpreter works like any other, that
is, it first expands all the include files, and then parses the
resulting text. Can anyone help with an explanation?

Thanks,
M. McDonnell

推荐答案



" Michael" < Mi *************** @ yahoo.com在留言中写道

新闻:11 *************** *******@z28g2000prd.googlegr oups.com ...

"Michael" <Mi***************@yahoo.comwrote in message
news:11**********************@z28g2000prd.googlegr oups.com...

由于在PHP脚本中调用include函数,为什么

包含的文件是否必须再次通过

将其自身标识为<?php ...<?>


假设PHP解释器的工作方式与其他任何一个一样,它们首先扩展所有包含文件,然后解析

结果文本。任何人都可以帮忙解释一下吗?
Since the include function is called from within a PHP script, why
does the included file have to identify itself as a PHP again by
enclosing its code in <?php... <?>

One would assume that the PHP interpreter works like any other, that
is, it first expands all the include files, and then parses the
resulting text. Can anyone help with an explanation?



因为php可以包含其他文本,例如html ...解析器只有

信号通知在php标签内的块上工作...


你有没有想过为什么<? php?看起来像一个HTML标签?因为它是!

Because a php can contain other text such as html... the parser is only
signaled to work on the block that is inside a the php tag...

you ever wonder why <? php ?looks like an html tag? cause it is!


5月28日下午6:03,Michael< MichaelDMcDonn ... @ yahoo.comwrote:
On May 28, 6:03 pm, Michael <MichaelDMcDonn...@yahoo.comwrote:

由于在PHP脚本中调用include函数,为什么

包含的文件必须再次通过

将其自身标识为PHP代码在<?php ...<?>


人们会认为PHP解释器的工作方式和其他任何一样,

是,它首先展开所有包含文件,然后解析

结果文本。任何人都可以帮忙解释一下吗?


谢谢,

M.麦克唐纳
Since the include function is called from within a PHP script, why
does the included file have to identify itself as a PHP again by
enclosing its code in <?php... <?>

One would assume that the PHP interpreter works like any other, that
is, it first expands all the include files, and then parses the
resulting text. Can anyone help with an explanation?

Thanks,
M. McDonnell



它'不应该被<?phpand<?>括起来,而是用<?php和?

It''s not supposed to be bracketed by <?phpand <?>, but by <?php and ?


>。但这并不是必要的。你必须将这些符号放入
>. That''s not necessary, though. You have to put those symbols into



你的require-d文件,如果你想要它被理解为像PHP代码,但

如果你不,它将被理解为原始输出。就像任何其他

php文件一样:

<?php

if(

your require-d file if you want it to be understood like php code, but
if you don''t, it will be understood as raw output. Just like any other
php file:
<?php
if (


x) {

?>

这里的一些输出

这里的一些输出

这里的一些输出

<?php

}否则{

?>

其他一些输出

some这里的其他输出

这里的其他一些输出

<?php

x ) {
?>
some output here
some output here
some output here
<?php
} else {
?>
some other output here
some other output here
some other output here
<?php


这篇关于为什么包含文件文本需要被&lt;?php&gt;括起来? ......&lt;?&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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