![]() The shell_exec() function is similar to exec(), however, it outputs the entire result as a string. => -rw-rw-r- 1 secuser secuser 49 Feb 27 20:54 shell.php ) shell_exec() => drwxrwxr-x 2 secuser secuser 4096 Feb 27 20:55. If a second parameter is specified, the result is returned in an array. ![]() > -rw-rw-r- 1 secuser secuser 29 Feb 27 20:49 shell.php Using echo with the exec() function will only print the last line of the command output. Otherwise, only the last line of the result will be shown if echoed. If a second optional parameter is specified, the result will be returned as an array. The exec() function accepts a command as a parameter but does not output the result. rw-rw-r- 1 secuser secuser 26 Feb 27 20:41 shell.php ĭrwxrwxr-x 2 secuser secuser 4096 Feb 27 20:43. Įxecuting the ls command on a Linux machine achieves a similar result. The following example on a Microsoft Windows machine will run the dir command to return a directory listing of the directory in which the PHP file is executed. The system() function accepts the command as a parameter and it outputs the result. Note: For the purposes of this article, we edited our hosts file and pointed the domain to a test server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |