略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: 程序执行

2024-11-14

系统程序执行

add a noteadd a note

User Contributed Notes 2 notes

up
-7
Anonymous
2 years ago
Backticks is probably going to be deprecated. It's safer to not use it.
See details why:
https://wiki.php.net/rfc/deprecate-backtick-operator-v2
up
-11
bishop at php dot net
2 years ago
Similar to these functions, there is also the backtick ("back-tick") execution operator:
                                                                                
https://www.php.net/manual/en/language.operators.execution.php                  
                                                                                
<?php
$output
= `ls -al`;
echo
"<pre>$output</pre>";
?>                                                                              

This operator runs the command given inside the backticks, and supports string interpolation just like double quotes:

<?php
    $dir
= addcslashes(sys_get_tmp_dir(), '"');      
    echo `
ls "{$dir}"`;     
?>

官方地址:https://www.php.net/manual/en/book.exec.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3