[請益] include 的效能

看板PHP作者 (newyellow)時間14年前 (2009/12/01 22:01), 編輯推噓1(105)
留言6則, 5人參與, 最新討論串1/1
我在建置網站的時候 把會用到的連結、connection、div等都寫在header.php 例如: <?php include "configs/conn.php" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Newyellow的個人網站</title> <?php include "mainstyle.php" ?> </head> <body> <div id="wrapper"> <div id="mainlinks"> <?php include "links.php" ?> </div> <div id="content"> 然後把 </div></body></html>等都寫在footer.php 然後我在做別的頁面的時候 內容就寫: <?php include "header.php" ?> //content... // //other php codes... // <?php include "footer.php" ?> 請問這樣寫會不會效能差? 因為我買了一個虛擬主機 裡面架了兩個站(放在兩個不同資料夾) 一個是 drupal 架的,一個是我自己寫的上述的架構 但有時候會有我自己的架構跑很久跑不太動 但 drupal 卻可以跑的情況 但有時候我自己寫的部分又很順 請問為什麼會這樣呢? 請問我這樣的include寫法是否會不好? 謝謝各位大大 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.119.233.117

12/01 22:48, , 1F
如果 pageview 太低,應該沒有差別很大。
12/01 22:48, 1F

12/01 22:48, , 2F
不用擔心。一定是卡在其他地方。
12/01 22:48, 2F

12/01 23:10, , 3F
卡在其他地方+1 
12/01 23:10, 3F

12/02 13:41, , 4F
include比較正確的用法:呼叫函式或物件使用。而非程式段
12/02 13:41, 4F

12/04 09:34, , 5F
謝謝大家的回覆^^
12/04 09:34, 5F

12/04 21:11, , 6F
HI 紐耶羅 你好 熱情的網友對你不錯喔~~~
12/04 21:11, 6F
文章代碼(AID): #1B5I7N56 (PHP)