1. <legend id='KOEDy'><style id='KOEDy'><dir id='KOEDy'><q id='KOEDy'></q></dir></style></legend>
    2. <tfoot id='KOEDy'></tfoot>

        <i id='KOEDy'><tr id='KOEDy'><dt id='KOEDy'><q id='KOEDy'><span id='KOEDy'><b id='KOEDy'><form id='KOEDy'><ins id='KOEDy'></ins><ul id='KOEDy'></ul><sub id='KOEDy'></sub></form><legend id='KOEDy'></legend><bdo id='KOEDy'><pre id='KOEDy'><center id='KOEDy'></center></pre></bdo></b><th id='KOEDy'></th></span></q></dt></tr></i><div id='KOEDy'><tfoot id='KOEDy'></tfoot><dl id='KOEDy'><fieldset id='KOEDy'></fieldset></dl></div>

        <small id='KOEDy'></small><noframes id='KOEDy'>

          <bdo id='KOEDy'></bdo><ul id='KOEDy'></ul>

        shell_exec() 在“ls"上返回 null

        时间:2024-04-13
          <bdo id='YIgST'></bdo><ul id='YIgST'></ul>
            <tbody id='YIgST'></tbody>

              <legend id='YIgST'><style id='YIgST'><dir id='YIgST'><q id='YIgST'></q></dir></style></legend>

              <small id='YIgST'></small><noframes id='YIgST'>

                <i id='YIgST'><tr id='YIgST'><dt id='YIgST'><q id='YIgST'><span id='YIgST'><b id='YIgST'><form id='YIgST'><ins id='YIgST'></ins><ul id='YIgST'></ul><sub id='YIgST'></sub></form><legend id='YIgST'></legend><bdo id='YIgST'><pre id='YIgST'><center id='YIgST'></center></pre></bdo></b><th id='YIgST'></th></span></q></dt></tr></i><div id='YIgST'><tfoot id='YIgST'></tfoot><dl id='YIgST'><fieldset id='YIgST'></fieldset></dl></div>
                • <tfoot id='YIgST'></tfoot>
                • 本文介绍了shell_exec() 在“ls"上返回 null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我有这段代码,我只是想在另一个目录中列出保存列表,其中 php 脚本位于 xampp 文件夹中,并且保存到此路径 /root/files/saves:

                  So I have this code and I'm only trying to make a list of the saves in another directory where the php scrip is in xampp folder and the saves are to this path /root/files/saves:

                  <html>
                  <body>
                  <?php
                  $output = shell_exec('ls /root/files/saves');
                  echo "<pre>$output</pre>";
                  ?>
                  </body>
                  </html>
                  

                  我不知道为什么我不能让它在 var_dump 上运行它似乎输出为空我真的很困惑它应该工作或者我完全错了我需要一些帮助.

                  I don't know why I can't get it working on a var_dump it seems output is null I'm really confuse it should work or I just it all wrong I need some help.

                  推荐答案

                  2>&1 添加到您的 shell 命令的末尾以使 STDERR 也返回作为 STDOUT.

                  Add 2>&1 to the end of your shell command to have STDERR returned as well as STDOUT.

                  $output = shell_exec("ls /root/files/saves 2>&1");
                  

                  另外,如果运行 PHP 的用户没有足够的权限查看 /root/ 中的输出,上述代码将返回 Permission denied 错误消息.

                  Also, if the user running PHP doesn't have sufficient permissions to view the output in /root/, the above code will return a Permission denied error message.

                  来源:http://php.net/manual/en/function.shell-exec.php#28994

                  这篇关于shell_exec() 在“ls"上返回 null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  <small id='U3Znx'></small><noframes id='U3Znx'>

                    <tbody id='U3Znx'></tbody>

                      • <bdo id='U3Znx'></bdo><ul id='U3Znx'></ul>

                        <i id='U3Znx'><tr id='U3Znx'><dt id='U3Znx'><q id='U3Znx'><span id='U3Znx'><b id='U3Znx'><form id='U3Znx'><ins id='U3Znx'></ins><ul id='U3Znx'></ul><sub id='U3Znx'></sub></form><legend id='U3Znx'></legend><bdo id='U3Znx'><pre id='U3Znx'><center id='U3Znx'></center></pre></bdo></b><th id='U3Znx'></th></span></q></dt></tr></i><div id='U3Znx'><tfoot id='U3Znx'></tfoot><dl id='U3Znx'><fieldset id='U3Znx'></fieldset></dl></div>
                        <legend id='U3Znx'><style id='U3Znx'><dir id='U3Znx'><q id='U3Znx'></q></dir></style></legend>

                        1. <tfoot id='U3Znx'></tfoot>