超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<declarerequire>
Last updated: Fri, 22 Jun 2007

return

如果在一个函数中调用,return() 语句立即结束此函数的执行并将它的参数作为函数的值返回。return() 也会终止 eval() 语句或者脚本文件的执行。

如果在全局范围中调用,则当前脚本文件中止运行。如果当前脚本文件是被 include() 的或者 require() 的,则控制交回调用文件。此外,如果当前脚本是被 include() 的,则 return() 的值会被当作 include() 调用的返回值。如果在主脚本文件中调用 return(),则脚本中止运行。如果当前脚本文件是在 php.ini 中的配置选项 auto_prepend_file 或者 auto_append_file 所指定的,则此脚本文件中止运行。

更多信息见返回值

注: 注意既然 return() 是语言结构而不是函数,并需要用括号将参数括起来。事实上不用括号比用括号更常见,尽管用哪一种并无所谓。




add a note add a note User Contributed Notes
return
17-Feb-2003 07:04
Use "exit()" to end all script execution for the current request. For HTTP requests, the response generated to that point will then be sent to the browser.

<declarerequire>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22