Very simple code:
<?php
$last_line = system('pwsh -Command (Get-Location).path', $retval);
Returning string on html page:
How is this possible and how to avoid it?
Very simple code:
<?php
$last_line = system('pwsh -Command (Get-Location).path', $retval);
Returning string on html page:
How is this possible and how to avoid it?
The PHP system()
command executing a system command and print immediately the output out. To avoid that you can use exec()
.
You can use ob_start()
to save the output of the command in a buffer. Then use ob_clean()
in order to clear that buffer without printing it.
ob_start();
$last_line = system('pwsh -Command (Get-Location).path', $retval);
ob_clean();