exit主要是用在后台程序中使用。
在shell执行程序,exit(返回值)结束程序之后,
如果是bash,用echo $?可以看到exit的返回值结果。

解决方案 »

  1.   

    忘了说明了!例子中代码为php,不是shell脚本呵呵
      

  2.   


    把代码改为(把int改为string):define('XXX_ERROR',"1");exit(XXX_ERROR);而不是数字。
      

  3.   

    只有在命令行下执行,你才会看到这个程序的exit返回值。
      

  4.   


    为啥直接echo XXX_ERROR;可以呢?
    只想知道下原因!谁能解答下?
      

  5.   

    -________-!
    gingzai777你来吧。
    你告诉他exit和echo有啥不一样。
      

  6.   

    void exit ( [string $status] )
    void exit ( int $status )status
    If status is a string, this function prints the status just before exiting. If status is an integer, that value will also be used as the exit status. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. The status 0 is used to terminate the program successfully. 只有为字符串的时候,才会输出.
      

  7.   

    PHP >= 4.2.0 does NOT print the status if it is an integer. 
      

  8.   

    你看五楼,人家问的是:为啥直接echo XXX_ERROR;可以呢?