从包含文件返回 [英] Return from include file
本文介绍了从包含文件返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PHP中,如何从包含的脚本返回到包含该脚本的脚本?
in PHP, how would one return from an included script back to the script where it had been included from?
IE:
1-主脚本 2-申请 3-包含
1 - main script 2 - application 3 - included
基本上,我想从3变回2,return()不起作用.
Basically, I want to get back from 3 to 2, return() doesn't work.
代码2-应用
$page = "User Manager";
if($permission["13"] !=='1'){
include("/home/radonsys/public_html/global/error/permerror.php");
return();
}
推荐答案
includeme.php:
includeme.php:
$x = 5;
return $x;
main.php:
$myX = require 'includeme.php';
也给出相同的结果
这是PHP鲜为人知的功能之一,但是对于设置非常简单的配置文件来说可能会很好.
This is one of those little-known features of PHP, but it can be kind of nice for setting up really simple config files.
这篇关于从包含文件返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文