輸出將顯示以下結果VolumeindriveCisWindows10VolumeSerialNumberis540D-CE99Directoryof"/> 輸出將顯示以下結果VolumeindriveCisWindows10VolumeSerialNumberis540D-CE99Directoryof">

首頁  >  文章  >  後端開發  >  PHP執行操作符

PHP執行操作符

WBOY
WBOY轉載
2023-09-18 10:17:07901瀏覽

PHP執行操作符

介紹

在PHP中定義了執行運算子。在反引號(``)中的字串被視為DOS指令(在UNIX/Linux中為shell指令),並傳回其輸出。此運算子的運算類似PHP中的shell_exec()函數。

以下程式碼執行DIR命令並將結果作為字串傳回。

範例

<?php
$list=`dir *.php`;
echo "$list";
?>

輸出

將顯示下列結果

Volume in drive C is Windows 10
Volume Serial Number is 540D-CE99
Directory of C:\xampp\php
01/27/2016 05:32 PM 18,869 CompatInfo.php
07/08/2020 06:40 PM 64 test.php
07/11/2020 02:13 PM 48 testscript.php
03/30/2013 05:59 PM 1,447 webdriver-test-example.php
4 File(s) 20,428 bytes
0 Dir(s) 178,002,157,568 bytes free

這是另一個反引號運算子的範例。它執行type指令

範例

<?php
$list=&#39;type testscript.php&#39;;
echo "$list";
?>

輸出

將顯示下列結果

type testscript.php

以上是PHP執行操作符的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除

相關文章

看更多