Calling java script in PHP
Collapse
X
-
Ok.. Markus... Then what does this return?
Code:`php myfile.php`
A string or ............... ..?
Regards
Dheeraj JoshiLeave a comment:
-
-
Actually, back-ticks, like in other languages, do run the contents as a shell command.actually… no. if you want to ‘execute’ a file you need to load/include it. and that doesn’t return a value…
and backticks are not valid string delimiters.Code:// 4 different ways to include a file include "file.php"; include_once "file.php"; require "file.php"; require_once "file.php";
the only constructs able to return a value are variables, constants, functions, properties and methods (the latter 2 being special cases from to objects)
Code:printf("PHP is located at %s", `which php`); // equivalent of doing printf("PHP is located at %s", shell_exec('which php'));Leave a comment:
-
take it out of the switch(), currently that’s preventing the print.Leave a comment:
-
-
yeah Mark..
I a gave that echo still it do not give anything.
Regards
Dheeraj JoshiLeave a comment:
-
I have either missed something obvious, or the javascript tag is completly wrong.
Should be:Code:"<scriptlanguage=javascript> alert('Blah Blah') </script>";
Code:echo "<script type=\"text/javascript\"> alert('Blah Blah') </script>";Leave a comment:
-
-
Ok.. Thanks..
Back to my java script problem?
How i have embedded the java script, is it correct?
Regards
Dheeraj JoshiLeave a comment:
-
-
You mean,
So this basically must hold the return value of function myfun() in myfile.Code:include("myfile.php"); $res=myfile::myfun();
Regards
Dheeraj JoshiLeave a comment:
-
actually… no. if you want to ‘execute’ a file you need to load/include it. and that doesn’t return a value…
and backticks are not valid string delimiters.Code:// 4 different ways to include a file include "file.php"; include_once "file.php"; require "file.php"; require_once "file.php";
the only constructs able to return a value are variables, constants, functions, properties and methods (the latter 2 being special cases from to objects)Leave a comment:
-
Yeah they are backticks
it executes file named myfile.php and gives the result back.Code:$res=`php myfile.php`
Regards
Dheeraj JoshiLeave a comment:
Leave a comment: