看板 PHP 關於我們 聯絡資訊
官方手冊裡面有這段: require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don't hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well. 簡言之,差別在「若被引入的檔案不存在,之後的程式碼會不會繼續執行」。 -- 所以,原 po 您測試用的那組程式無法測出差異,因為之後沒有其他程式碼了。 -- .╭═════╮. . 。╭═╮╭╮. o . o . ╰═╗ ╔═╯╭══╮╭══╮║. ║║╭══╮╭╮. ╭══╮ ◥██◤o o║╭╮║║╭╮║║╚═╝║║╭╮║║╘═╮║╭╮║。 ◥◤ ║▍║ ║║║║║╰╯║║▍╔═╗║║║║║║╔═╯║║║║ o . ╭╯▃ ║╰╯║║══╯║▃║║║╰╯║║║o.║║║║. .  ╰══╯ ╰══╯╰══╯╰═╯ ╰╯╰══╯╰╯ ╰╯╰╯By meei0531 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.254.19.103