PHP嵌套包含在批处理php进程中

时间:2018-05-15 13:49:59

标签: php nested include

我的问题是在包含嵌套包含的php批处理作业中。如果我从桌面上的快捷方式运行作业一切都很好。如果作业由任务计划程序启动(这是必须如何在生产中运行),嵌套包括拒绝执行。我的网络服务器是Windows Server上的IIS。 工作结构如下所示。

file1.php是小“主”模块,file3.php完成实际工作。 持有file1.php的目录包含dira1和dirb1。 file1.php中的包含正常执行。 如果作业通过我的快捷方式运行,则执行file3.php中的包含。如果作业通过任务计划程序运行,则不是。如果我将完整的作业放在file1.php中(因此使用inlcludes但不嵌套),作业将成功运行。

file1.php:

include 'dira1/file2.php';
include 'dira1/dira2/dira3/file3.php';

file3.php:

include 'dirb1/dirb2/file4.php';
include 'dira1/dira2/dira3/file5.php';

感谢您的帮助。 JackNWK

1 个答案:

答案 0 :(得分:2)

为此目的,PHP包含componentDidMount(){ this.props.checkForToken(); // async method } // Async Action export const checkForToken = () => async dispatch => { console.log("action - does token exist ?"); let t = await AsyncStorage.getItem("jwt"); if (t) { console.log("action - token exists"); // Dispatch an action, login success dispatch({ type: LOGIN_SUCCESS, payload: t }); } else { return null; } } // WelcomeScreen.js continued componentWillRecieveProps(nextProps){ this.authComplete(nextProps); } authComplete(props){ if(props.token){ props.navigation.navigate('map'); // called again and again when I try to navigate from within the Bottom Tab Bar Component } } render(){ if(this.props.appLoading){ // default True return ( <ActivityIndicator />); } return ( <Text>WelcomeScreen</Text> ); } const mapStateToProps = state => { return { token: state.auth.token, appLoading: state.auth.appLoading // default True }; }; export default connect(mapStateToProps, actions)(WelcomeScreen); 常量。 __DIR__指的是当前脚本所在的目录。

我总是建议使用__DIR__常量包含来自当前脚本的相对路径的文件。

__DIR__