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

问题描述

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

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


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

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


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

低级脚本的启动脚本。


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

立即包括?


-
本文由作者的请求发布

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

主题网址:

访问主题网址联系作者(reg。 req''d)。举报滥用行为:

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

推荐答案




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

的东西。


正如我所说,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





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

...



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



这个



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



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开发人员能够回复为什么不简单地将脚本包含在包含脚本的

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


-
本文由作者的请求发布

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

主题网址:

访问主题网址以联系作者(reg.req''d)。举报滥用行为:



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感到沮丧?“包含”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 07:35