dougu9895
dougu9895
2013-10-29 07:44
浏览 32
已采纳

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

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanhui7329
    duanhui7329 2013-10-29 09:05
    已采纳

    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.

    :)

    点赞 评论
  • dprc88435
    dprc88435 2013-10-29 07:58

    As Exception is an object try print_r() function instead of echo.

    点赞 评论

相关推荐