Re: [請益] include與require的差異在於引入外部檔 …
官方手冊裡面有這段:
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
o 。║▍║。o║╭╮║║╭╮║║▍╚═╝║║╭╮║║╘═╮║╭╮║。 ◥◤ 。
。 ║▍║ 。 ║║║║║╰╯║║▍╔═╗║║║║║║╔═╯║║║║ o ∥ o .
。╭╯▃║o ║╰╯║║══╯║▃║。║║║╰╯║║║o。.║║║║. 。∥ . 。
╰══╯ ╰══╯╰══╯╰═╯ ╰╯╰══╯╰╯ ╰╯╰╯By meei0531
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.254.19.103
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 2 之 6 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章