[問題] head裡的東西跑走了@@

看板Web_Design作者 (腳男)時間13年前 (2012/11/21 15:06), 編輯推噓1(1014)
留言15則, 4人參與, 最新討論串1/1
我用php寫下了 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title><?php echo $title; ?></title> <link rel="stylesheet" href="style.css" type="text/css"> <script type="text/javascript" src="" rel="nofollow">http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> $(function(){ var ViewportHeight=document.body.clientHeight; ViewportHeight -= 20; $("#main_table").attr('height',ViewportHeight); }); </script> </head> 可是丟到伺服器上跑以後他就變成 <html> <head> </head> <body cz-shortcut-listen="true"> "" <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title><?php echo $title; ?></title> <link rel="stylesheet" href="style.css" type="text/css"> <script type="text/javascript" src="" rel="nofollow">http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> $(function(){ var ViewportHeight=document.body.clientHeight; ViewportHeight -= 20; $("#main_table").attr('height',ViewportHeight); }); </script> .... head裡面的東西全部都被丟到body裡面 請問為什麼會發生這種事呢 是我有少加什麼嗎 還是說這是PHP的問題要換板問Q_Oꨊ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.130.128.171

11/21 15:13, , 1F
你在head裡面放JQ這樣好嗎?
11/21 15:13, 1F

11/21 15:19, , 2F
以前上課都加在head裡面 所以也不知道好還是不好@@
11/21 15:19, 2F

11/21 15:52, , 3F
把jq放到head之外吧~ 連meta都跑出來~那就有問題了
11/21 15:52, 3F

11/21 16:30, , 4F
跟JQ沒關係,而且JS檔放尾巴或HEAD裡看狀況調整
11/21 16:30, 4F

11/21 16:32, , 5F
這個要看你PHP內的server code有沒有輸出一些不對的東西
11/21 16:32, 5F

11/21 17:04, , 6F
所以這是php server的問題囉?我沒有權限的話是不是沒法解
11/21 17:04, 6F

11/21 17:04, , 7F
決了呢?
11/21 17:04, 7F

11/22 00:03, , 8F
你貼的是完整的php檔案嗎?c大的意思是~可能在php上有問題
11/22 00:03, 8F

11/22 13:13, , 9F
找到問題了@@是我require_once了一個檔案 內容只有載入
11/22 13:13, 9F

11/22 13:14, , 10F
title的變數 可能是只有一行所以變得怪怪的吧...
11/22 13:14, 10F

11/22 17:48, , 11F
require_once 寫在html之外吧
11/22 17:48, 11F

11/22 17:55, , 12F
require_once是在html外沒錯 可是我放內外都有一樣問題
11/22 17:55, 12F

11/22 17:56, , 13F
最後解決的方法是放在另一個資料比較多的php裡
11/22 17:56, 13F

11/22 17:56, , 14F
在require_once這個php檔 問題就不見了
11/22 17:56, 14F

11/22 17:56, , 15F
感謝各位的幫助 謝謝大家了
11/22 17:56, 15F
文章代碼(AID): #1Gh7sBXW (Web_Design)