PHP系统(“cd \”);(PHP system(“cd \”); not working)

编程入门 行业动态 更新时间:2024-10-25 16:24:10
PHP系统(“cd \”);(PHP system(“cd \”); not working)

我以前通过php文件使用系统命令.cd \工作然后在几次尝试之后突然停止:| 不管我做什么

<?php $command = array("cd \","dir"); $result = system($command[0], $return); ?>

i used to use system commands through a php file ..cd \ was working then suddenly after a few tries it stopped :| no matter what i do

<?php $command = array("cd \","dir"); $result = system($command[0], $return); ?>

最满意答案

Windows支持正斜杠/以及反斜杠\所以通过使用正斜杠,你应该交叉兼容,并且从长远来看不会恶化。

<?php $command = array("cd /","dir"); $result = system($command[0], $return); ?>

Wiki Path_Computing


如果您有任何错误,请发布它们,因为问题可能不是目录削减,因为您说它以前工作。

I think i figured out the problem.. the system() command in PHP does not create an instance of a cmd.exe instead it only executes the command and exits. that is why when you change directory using CD command ..the directory of the instance created by system() is changed and then exits.i hope my theory is correct xD

更多推荐

本文发布于:2023-04-28 01:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329646.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:系统   PHP   cd   working   system

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!