对PHP感到沮丧?“包含” [英] Frustrated with PHP?s "include"

查看:58
本文介绍了对PHP感到沮丧?“包含”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对php包含的内容非常沮丧,因为我已经花了大量的时间在它上面......任何人都可以告诉我为什么它的设计是这样的

(或者我得不到的东西)?


include中的路径是相对的,而不是包含它的直接脚本

,但是相对于顶级调用脚本。


在实践中,这意味着你必须经常担心并调整包含中的
路径,基于调用这些

低级脚本的启动脚本。


为什么包含路径不仅仅是相对于脚本的

立即包括?


-
http ://www.dbForumz.com/ 本文由作者的请求发布

单独检查文章是否符合usenet标准

主题网址: http://www.dbForumz.com/PHP-Frustrat...ict132935.html

访问主题网址联系作者(reg。 req''d)。举报滥用行为: http://www.dbForumz.com/eform.php ?p = 443884

I am quite frustrated with php?s include, as I have spent a ton of
time on it already... anyone can tell me why it was designed like this
(or something I don?t get)?

The path in include is relative NOT to the immediate script that is
including it, but is relative to the top-level calling script.

In practice, this means that you have to constantly worry and adjust
paths in includes, based on the startup scripts that call these
lower-level scripts.

Why is the include path not simply relative to the script that is
immediately including?

--
http://www.dbForumz.com/ This article was posted by author''s request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Frustrat...ict132935.html
Visit Topic URL to contact author (reg. req''d). Report abuse: http://www.dbForumz.com/eform.php?p=443884

推荐答案

steve写道:
我对php的s很沮丧包括,因为我已经花了很多时间......任何人都可以告诉我它为什么设计成这样的
(或者我不能得到的东西)?

include中的路径是相对于包含它的直接脚本,而是相对于顶级调用脚本。

实际上,这意味着你必须经常担心并根据调用这些
低级脚本的启动脚本调整包含的路径。

为什么包含路径不仅仅是相对于立即包括?
I am quite frustrated with php?s include, as I have spent a ton of
time on it already... anyone can tell me why it was designed like this
(or something I don?t get)?

The path in include is relative NOT to the immediate script that is
including it, but is relative to the top-level calling script.

In practice, this means that you have to constantly worry and adjust
paths in includes, based on the startup scripts that call these
lower-level scripts.

Why is the include path not simply relative to the script that is
immediately including?




你可以随时提供完整的路径,在这种情况下你不必担心

的东西。


正如我所说,PHP中的包含更像是合并。

// Aho



You can always give the full path, in which case you don''t have to worry about
things.

As I have understod, the include in PHP works more like a merge.
//Aho


史蒂夫写道:
我对php包含的内容感到非常沮丧,因为我已经花费了大量的时间......任何人都可以告诉我为什么它的设计是这样的/>(或者我得不到的东西)?

include中的路径是相对于包含它的直接脚本,而是相对于顶级调用脚本。

在实践中,这意味着您必须根据调用这些较低级别脚本的启动脚本,不断担心并调整包含路径。

为什么包含路径不仅仅是相对于
立即包含的脚本?
I am quite frustrated with php?s include, as I have spent a ton of
time on it already... anyone can tell me why it was designed like this
(or something I don?t get)?

The path in include is relative NOT to the immediate script that is
including it, but is relative to the top-level calling script.

In practice, this means that you have to constantly worry and adjust
paths in includes, based on the startup scripts that call these
lower-level scripts.

Why is the include path not simply relative to the script that is
immediately including?




您可以在脚本中设置包含路径无论如何。因此,相对于任何最常见的包含路径,您可以包含

...



You can set your include path in your script anyway. So you can include
relative to any of your most common include paths...


" neur0maniak"写道:
"neur0maniak" wrote:
史蒂夫写道:
我对php包括了很沮丧,因为我已经花了一大笔
的时间就已经......任何人可以告诉我为什么它被设计为
I am quite frustrated with php?s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like


这个

(或者我不能得到的东西)?

包含的路径是相对的到
包含它的直接脚本,但是相对于顶级调用脚本。

实际上,这意味着你必须经常担心并且
调整路径in,包括,基于调用这些
低级脚本的启动脚本。

为什么包含路径不仅仅是相对于
立即包含的脚本?
(or something I don?t get)?

The path in include is relative NOT to the immediate script that is including it, but is relative to the top-level calling script.

In practice, this means that you have to constantly worry and adjust paths in includes, based on the startup scripts that call these
lower-level scripts.

Why is the include path not simply relative to the script that is
immediately including?



无论如何,您可以在脚本中设置包含路径。因此,您可以相对于任何最常见的包含路径包含
...



You can set your include path in your script anyway. So you can
include
relative to any of your most common include paths...




J.O.和neur0maniak,

感谢您的回复。虽然它可以管理,但它仍然是一个巨大的维护痛苦。我希望有些php开发人员能够回复为什么不简单地将脚本包含在包含脚本的

中,避免所有的维护问题。


-
http://www.dbForumz.com/ 本文由作者的请求发布

单独检查文章是否符合usenet标准

主题网址: http://www.dbForumz.com/PHP-Frustrat...ict132935.html

访问主题网址以联系作者(reg.req''d)。举报滥用行为: http://www.dbForumz.com/eform.php ?p = 443945



J.O. and neur0maniak,
Thanks for your responses. While it can be managed, it is still a
huge maintenance pain. I am hoping that some php developers would
respond as to why not make script inclusion simply relative to the
including script, avoiding all the maintenance problems.

--
http://www.dbForumz.com/ This article was posted by author''s request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Frustrat...ict132935.html
Visit Topic URL to contact author (reg. req''d). Report abuse: http://www.dbForumz.com/eform.php?p=443945


这篇关于对PHP感到沮丧?“包含”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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