1. <legend id='KHRRi'><style id='KHRRi'><dir id='KHRRi'><q id='KHRRi'></q></dir></style></legend><tfoot id='KHRRi'></tfoot>
    2. <small id='KHRRi'></small><noframes id='KHRRi'>

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

        escapeshellarg 和escapeshellcmd 有什么区别?

        What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
        <tfoot id='lxNBy'></tfoot>
          <bdo id='lxNBy'></bdo><ul id='lxNBy'></ul>
            <i id='lxNBy'><tr id='lxNBy'><dt id='lxNBy'><q id='lxNBy'><span id='lxNBy'><b id='lxNBy'><form id='lxNBy'><ins id='lxNBy'></ins><ul id='lxNBy'></ul><sub id='lxNBy'></sub></form><legend id='lxNBy'></legend><bdo id='lxNBy'><pre id='lxNBy'><center id='lxNBy'></center></pre></bdo></b><th id='lxNBy'></th></span></q></dt></tr></i><div id='lxNBy'><tfoot id='lxNBy'></tfoot><dl id='lxNBy'><fieldset id='lxNBy'></fieldset></dl></div>

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

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

                  <tbody id='lxNBy'></tbody>

                  本文介绍了escapeshellarg 和escapeshellcmd 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  PHP 有两个密切相关的函数,escapeshellarg()escapeshellcmd().它们似乎都在做类似的事情,即帮助使字符串在 system()/exec()/etc. 中更安全地使用.

                  PHP has 2 closely related functions, escapeshellarg() and escapeshellcmd(). They both seem to do similar things, namely help make a string safer to use in system()/exec()/etc.

                  我应该使用哪个?我只是希望能够接受一些用户输入并在其上运行命令,而不是让一切都崩溃.如果 PHP 有一个 exec-type-function 接受一个字符串数组(如 argv),它绕过 shell,我会使用它.类似于 Python 的 subprocess.call()功能.

                  Which one should I use? I just want to be able to take some user input and run a command on it, and not have everything blow up. If PHP had an exec-type-function that took an array of strings (like argv), which bypasses the shell, I'd use that. Similar to Python's subprocess.call() function.

                  推荐答案

                  来自 http://ie2.php.net/manual/en/function.escapeshellarg.php

                  escapeshellarg() 添加单引号围绕字符串和引号/转义任何现有的单引号允许您将字符串直接传递给 shell函数并将其视为单个安全参数.

                  escapeshellarg() adds single quotes around a string and quotes/escapes any existing single quotes allowing you to pass a string directly to a shell function and having it be treated as a single safe argument.

                  escapeshellarg,顾名思义,用作传递 shell 参数.比如要列出当前目录,

                  escapeshellarg, as its name indicates, is used as passing shell argument(s). For example, you want to list current directory,

                  $dir = ".";
                  system('ls '.escapeshellarg($dir));
                  escapeshellcmd('ls $dir');
                  

                  两者都做类似的事情,仅取决于您如何处理逻辑,请确保在直接传递给这些方法之前对输入进行规范化和验证以提高安全性.

                  Both do similar things and simply depends on how you handle your logic, do make sure your normalize and validate your input before passing directly to these methods for better security.

                  这篇关于escapeshellarg 和escapeshellcmd 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

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

                  1. <legend id='gpUc4'><style id='gpUc4'><dir id='gpUc4'><q id='gpUc4'></q></dir></style></legend>

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