系统程序执行

User Contributed Notes

Anonymous 20-Oct-2019 06:59
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
bishop at php dot net 10-Oct-2019 02:47
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}"`;     
?>
PHP8中文手册 站长在线 整理 版权归PHP文档组所有