PHP鎺у埗缁撴瀯涔媟eturn

鍐呭鎽樿
濡傛灉鍦ㄤ竴涓嚱鏁颁腑璋冪敤 return() 璇彞锛屽皢绔嬪嵆缁撴潫姝ゅ嚱鏁扮殑鎵ц骞跺皢瀹冪殑鍙傛暟浣滀负鍑芥暟鐨勫艰繑鍥炪俽eturn() 涔熶細缁堟 eval() 璇彞鎴栬呰剼鏈枃浠剁殑鎵ц銆
鏂囩珷姝f枃
return
濡傛灉鍦ㄤ竴涓嚱鏁颁腑璋冪敤 return() 璇彞锛屽皢绔嬪嵆缁撴潫姝ゅ嚱鏁扮殑鎵ц骞跺皢瀹冪殑鍙傛暟浣滀负鍑芥暟鐨勫艰繑鍥炪俽eturn() 涔熶細缁堟 eval() 璇彞鎴栬呰剼鏈枃浠剁殑鎵ц銆

濡傛灉鍦ㄥ叏灞鑼冨洿涓皟鐢紝鍒欏綋鍓嶈剼鏈枃浠朵腑姝㈣繍琛屻傚鏋滃綋鍓嶈剼鏈枃浠舵槸琚 include() 鐨勬垨鑰 require() 鐨勶紝鍒欐帶鍒朵氦鍥炶皟鐢ㄦ枃浠躲傛澶栵紝濡傛灉褰撳墠鑴氭湰鏄 include() 鐨勶紝鍒 return() 鐨勫间細琚綋浣 include() 璋冪敤鐨勮繑鍥炲笺傚鏋滃湪涓昏剼鏈枃浠朵腑璋冪敤 return()锛屽垯鑴氭湰涓杩愯銆傚鏋滃綋鍓嶈剼鏈枃浠舵槸鍦 php.ini 涓殑閰嶇疆閫夐」 auto_prepend_file 鎴栬 auto_append_file 鎵鎸囧畾鐨勶紝鍒欐鑴氭湰鏂囦欢涓杩愯銆

鏇村淇℃伅瑙佽繑鍥炲笺

Note: 娉ㄦ剰鏃㈢劧 return() 鏄瑷缁撴瀯鑰屼笉鏄嚱鏁帮紝鍥犳鍏跺弬鏁版病鏈夊繀瑕佺敤鎷彿灏嗗叾鎷捣鏉ャ傞氬父閮戒笉鐢ㄦ嫭鍙凤紝瀹為檯涓婁篃搴旇涓嶇敤锛岃繖鏍峰彲浠ラ檷浣 PHP 鐨勮礋鎷呫

Note: 褰撶敤寮曠敤杩斿洖鍊兼椂姘歌繙涓嶈浣跨敤鎷彿锛岃繖鏍疯涓嶉氥傚彧鑳介氳繃寮曠敤杩斿洖鍙橀噺锛岃屼笉鏄鍙ョ殑缁撴灉銆傚鏋滀娇鐢 return ($a); 鏃跺叾瀹炰笉鏄繑鍥炰竴涓彉閲忥紝鑰屾槸琛ㄨ揪寮 ($a) 鐨勫硷紙褰撶劧锛屾鏃惰鍊间篃姝f槸 $a 鐨勫硷級銆

浠ヤ笂灏辨槸PHP鎺у埗缁撴瀯涔媟eturn鐨勮缁嗗唴瀹癸紝鏇村淇℃伅璇峰叧娉∣D浜戝叾瀹冪浉鍏虫枃绔狅紒



鏈枃URL锛http://www.odweb.cn/news_show.html?id=85