Created
January 30, 2013 02:41
-
-
Save haio/4670140 to your computer and use it in GitHub Desktop.
if __FILE__ == $0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __FILE__ == $0 | |
__FILE__ 是一个魔法值,它存有现在运行的脚本文件的名字。$0 是启动脚本的名字。 代码里的比较结构的意思是 “如果这是启动脚本的话...” 这允许代码作为库调用的时候不运行启动代码, 而在作为执行脚本的时候调用启动代码。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment