开发者

Can we use include (”TheWalkin.php”) two times in a PHP page “makeit.PHP”?

I it possible to include 开发者_如何学Gotwo times a page called walkin in a page makeit.php


Yes.

But the code will be executed twice.

If you only want it to be included once, use the aptly named include_once.

Problems may occur if you define functions or classes or connections twice. Why do you want to include twice?


It depends. PHP's include() acts like a copy and paste, so your question is equivalent to "Can we copy and paste 'TheWalkin.php' two times in a PHP page?

If there are no function or class definitions in TheWalkin.php, yes.

EDIT: Maybe you want to look at this: include_once. It makes sure you are only include a file once.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜