I have a /Users/dele/Desktop/TestIOS/testPhp01/cms/test04.php
file:
<?php
/**
* Created by PhpStorm.
* User: dele
* Date: 2019/9/26
* Time: 11:56 AM
*/
exec("ls -l");
When I run this file, there shows only one file output,
/usr/local/Cellar/[email protected]/7.0.30_1/bin/php /Users/dele/Desktop/TestIOS/testPhp01/cms/test04.php
string(54) "-rw-r--r-- 1 dele staff 133 Oct 8 12:03 test04.php"
Process finished with exit code 0
but in my directory /Users/dele/Desktop/TestIOS/testPhp01/cms/
, there have those files:
dele-MBP:cms ldl$ ls -l
total 48
-rw-r--r-- 1 ldl staff 0 Aug 20 16:49 1
-rw-r--r-- 1 ldl staff 42 Aug 20 16:49 2.js
-rw-r--r-- 1 ldl staff 165 Feb 18 2019 index.php
-rw-r--r-- 1 ldl staff 551 Aug 30 17:36 test01.php
-rw-r--r-- 1 ldl staff 1308 Sep 8 00:38 test02.php
-rw-r--r-- 1 ldl staff 1444 Sep 10 23:09 test03.php
-rw-r--r-- 1 ldl staff 107 Oct 8 11:56 test04.php
try using output param:
exec("ls -l", $r);
var_dump($r);