Executing php script with parameter using powershell
Get the solution ↓↓↓I am trying to call thePHP
file by, passing therequest_number
in the localhost URL usingPowershell
In HTML:
<a href='workflow_execution_progress.php?view_id=".$row['request_number']."' title='Click to see the progress of workflow'>
I referred to this link but not sure to modify it with parameters. Executing php script on powershell
Update: My PowerShell
$PhpExe = "C:\path\to\php\install\dir\php.exe"
$PhpFile = "C:\path\to\script.php"
$PhpArgs = '-f "{0}"' -f $PhpFile //args like view_id = 1 / 2 /3 (dynamically)
$PhpOutput = & $PhpExe $PhpArgs
Answer
Solution:
You can use$argv
to get an array of arguments passed to the script.
https://www.php.net/manual/en/reserved.variables.argv.php
php script.php arg1 arg2 arg3
<?php
var_dump($argv);
?>
array(4) {
[0]=>
string(10) "script.php"
[1]=>
string(4) "arg1"
[2]=>
string(4) "arg2"
[3]=>
string(4) "arg3"
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: npm err! code 1
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.