Phonegap Project不是通过php脚本创建的
问题描述:
I can create phonegap project on terminal when use phonegap create command but when i use php script to create phonegap project it is not creating not even display any error message or warning.
PHP :-
<?php
try {
$command = 'phonegap create hello com.example.hello HelloWorld';
exec($command);
}
catch(Exception $ex) {
echo $ex->getMessage();
}
?>
Note: Above Problem is not about how to print exception or warning it is regarding to create phonegap project through php script
答
This is your code:
<?php
try {
$command = 'phonegap create hello com.example.hello HelloWorld';
exec($command);
}
catch(Exception $ex) {
echo $ex->getMessage();
}
?>
Here is what i did.
1) I installed Phonegap CLI
2) I created the environment varible for the php.exe path
3) i create a folder c:\php\test.php with your code in that php file.
It worked.
I got a folder called "hello" with the respectable files in it.
:)
答
As Exception is an object try print_r() function instead of echo.