PHP的定义,以包括文件 [英] php define to include file
本文介绍了PHP的定义,以包括文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否以及如何定义要包含的文件.
I want to know if and how I can define a file to be included.
例如
<?php
//define('_login',inlcude('file.php'));
define('_login',include('file.php')); // edited due to typo..
?>
或者我需要这样做
<?php
define('_login','file.php');
include(_login);
?>
我问的原因是我的网站允许插件",并且我希望其他开发人员覆盖定义以包括其插件,而不是核心_login定义.
the reason I ask is My site allows plugins and I want other developers to overwrite a define to include their plugin instead of the core _login define.
推荐答案
这应该没问题:
<?php
define('_login','file.php');
include(_login);
?>
事件无法想象在第一种情况下会发生什么.也许如果您从文件中返回了某些内容,该值将被使用吗?
Event can't imagine what will happen in first case. Maybe if you return something from file - that value will be used?
这篇关于PHP的定义,以包括文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文