php - 使用 php exec() 调用该批处理文件时,批处理文件重定向到一个空文件
问题描述
我有一个 Windows 批处理文件gcloud_batch.bat
:
gcloud auth application-default print-access-token > token.txt
和 php 文件:
exec("gcloud_batch.bat", $output, $return);
当我从浏览器运行 php 文件时,它创建token.txt
但为空。但是当我从命令行运行批处理文件时它工作得很好。
我错过了什么?
解决方案
推荐阅读
- c++ - 替代动态创建变量名
- java - 使用 lambda 优化 Stream
- transactions - 如何在超级账本中获取交易历史
- sql - 如何在案例选择查询中选择 LONG 列
- mysqli - 防止 SQL 注入和 XSS
- mysql - 如何为特定的复合键(MyISAM)重置 AUTO_INCREMENT?
- git - 如何从 Github 克隆项目并通过终端将其保存为 VS Code 中的工作区
- css - VS 代码 - 如何自动格式化 CSS?
- hibernate - 验证发送到数据库的数据是否真的来自前端
- python - Python 崩溃 EXC_BAD_ACCESS (SIGSEGV)