2011-04-03 95 views
0

我正在嘗試動態更改我的頁面標題。我有我的內頁的header.php動態頁面標題顯示不正確

<?php $pagetitle = "Website Home"; ?> 
<head> 
<title><?php echo $pagetitle ?></title> 
</head> 

,而不是我的網頁標題顯示爲「網站首頁」,但下面的腳本,頁面標題顯示爲「<?php echo $pagetitle ?>」。是否有一個原因,爲什麼php不會在<title>標籤內執行?

+0

你會得到什麼?<?php $ pagetitle =「Website Home」; ?> – 2011-04-03 06:13:02

+2

*您的任何* PHP代碼是否正確執行?如果您的翻譯員正在工作,則不應打印''內的任何內容。 – Blender 2011-04-03 06:15:55

+0

如果我在''標籤內放入'<?php echo $ pagetitle?>',則顯示「網站主頁」。我只在''標籤內部遇到問題。你可以在[link](http://www.byukinnect.org/beta/) – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/689579/">Sean</a></span> <span>2011-04-03 06:30:47</span> </small> </span> </p> </div> </div> </div> </div> </div> </article> </div> <div class="answer-title"> <span class="text-logo margin-top-sm">A</span> <h2 class="title h4">回答</h2> </div> <div class="item-description text-md markdown-body margin-bottom-40 voidso"> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">2<i class="fa fa-thumbs-up"></i></span> <i class="fa fa-check fa-2x"></i> </div> <div class="post-offset"> <div class="answer fmt"> <p>你打電話給你的header.php一些不尋常的方式。只需<code class="prettyprint-override">include</code>它在其他的PHP腳本。</p> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/5528144">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2011-04-03 07:10:17</span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> <!-- comments --> <div class="comments"> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">Shrapnel謝謝。我在我的索引頁面中使用腳本來更改標題中的js腳本,這導致了問題。如果我只用include('header.php')包含頭部,''它工作得很好。 – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/689579/">Sean</a></span> <span>2011-04-03 17:23:32</span> </small> </span> </p> </div> </div> </div> </div> </div> </article> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1038284119" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="clearfix"> </div> <div class="relative-box"> <div class="relative">相關問題</div> <ul class="relative_list"> <li> 1. <a href="http://hk.uwenku.com/question/p-cbrunokn-uc.html" target="_blank" title="PHP頁面標題標記顯示不正確"> PHP頁面標題標記顯示不正確 </a> </li> <li> 2. <a href="http://hk.uwenku.com/question/p-nqzjnbxg-ov.html" target="_blank" title="頁面顯示不正確"> 頁面顯示不正確 </a> </li> <li> 3. <a href="http://hk.uwenku.com/question/p-unrtsopz-km.html" target="_blank" title="在動態頁面上獲取正確的頁面標題?"> 在動態頁面上獲取正確的頁面標題? </a> </li> <li> 4. <a href="http://hk.uwenku.com/question/p-tuisggqo-kb.html" target="_blank" title="標題顯示不正確"> 標題顯示不正確 </a> </li> <li> 5. <a href="http://hk.uwenku.com/question/p-govivvpd-c.html" target="_blank" title="標題顯示不正確"> 標題顯示不正確 </a> </li> <li> 6. <a href="http://hk.uwenku.com/question/p-wkmzwnte-dc.html" target="_blank" title="啓動引導主題在Github頁面中顯示不正確"> 啓動引導主題在Github頁面中顯示不正確 </a> </li> <li> 7. <a href="http://hk.uwenku.com/question/p-sodhwzwo-bac.html" target="_blank" title="htaccess問題:標題投擲404雖然頁面正確顯示"> htaccess問題:標題投擲404雖然頁面正確顯示 </a> </li> <li> 8. <a href="http://hk.uwenku.com/question/p-vzstaimp-bmk.html" target="_blank" title="wp_title顯示頁面標題,但不顯示網站標題"> wp_title顯示頁面標題,但不顯示網站標題 </a> </li> <li> 9. <a href="http://hk.uwenku.com/question/p-ydwrofar-rz.html" target="_blank" title="頁面邊框顯示不正確"> 頁面邊框顯示不正確 </a> </li> <li> 10. <a href="http://hk.uwenku.com/question/p-dftkzdit-wn.html" target="_blank" title="路徑不顯示正確的頁面"> 路徑不顯示正確的頁面 </a> </li> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-6208739752673518" data-ad-slot="4606349252"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <li> 11. <a href="http://hk.uwenku.com/question/p-vstdssak-vp.html" target="_blank" title="Facebook oauth頁面顯示不正確"> Facebook oauth頁面顯示不正確 </a> </li> <li> 12. <a href="http://hk.uwenku.com/question/p-xentrbas-bnu.html" target="_blank" title="PHP頁面不能正確顯示"> PHP頁面不能正確顯示 </a> </li> <li> 13. <a href="http://hk.uwenku.com/question/p-qnxpjwar-ks.html" target="_blank" title="IE8顯示頁面不正確"> IE8顯示頁面不正確 </a> </li> <li> 14. <a href="http://hk.uwenku.com/question/p-aehzykix-ue.html" target="_blank" title="輸出頁面顯示不正確"> 輸出頁面顯示不正確 </a> </li> <li> 15. <a href="http://hk.uwenku.com/question/p-uwaiehdy-bmp.html" target="_blank" title="asp.net頁面顯示不正確"> asp.net頁面顯示不正確 </a> </li> <li> 16. <a href="http://hk.uwenku.com/question/p-uqnheepo-bhd.html" target="_blank" title="Ampache安裝頁面顯示不正確"> Ampache安裝頁面顯示不正確 </a> </li> <li> 17. <a href="http://hk.uwenku.com/question/p-tomgstdy-bhg.html" target="_blank" title="codeigniter我的頁面正確顯示,但標題說404錯誤"> codeigniter我的頁面正確顯示,但標題說404錯誤 </a> </li> <li> 18. <a href="http://hk.uwenku.com/question/p-ntgegnsg-bkw.html" target="_blank" title="如何在expressJS中正確顯示動態頁面?"> 如何在expressJS中正確顯示動態頁面? </a> </li> <li> 19. <a href="http://hk.uwenku.com/question/p-deqdizyl-ba.html" target="_blank" title="靜態頁面不顯示圖標"> 靜態頁面不顯示圖標 </a> </li> <li> 20. <a href="http://hk.uwenku.com/question/p-tdxsnteu-eh.html" target="_blank" title="TabLayout標題顯示不正確"> TabLayout標題顯示不正確 </a> </li> <li> 21. <a href="http://hk.uwenku.com/question/p-zucpyigz-bhq.html" target="_blank" title="ListView顯示不正確的標題"> ListView顯示不正確的標題 </a> </li> <li> 22. <a href="http://hk.uwenku.com/question/p-xypmyeua-bhz.html" target="_blank" title="ListView中顯示不正確的標題"> ListView中顯示不正確的標題 </a> </li> <li> 23. <a href="http://hk.uwenku.com/question/p-ogcgjtfi-bnx.html" target="_blank" title="BuddyPress標題顯示不正確"> BuddyPress標題顯示不正確 </a> </li> <li> 24. <a href="http://hk.uwenku.com/question/p-tcscattp-cw.html" target="_blank" title="Swift UICollectionView標題顯示不正確"> Swift UICollectionView標題顯示不正確 </a> </li> <li> 25. <a href="http://hk.uwenku.com/question/p-hhsiuzis-dc.html" target="_blank" title="Wordpress圖像標題顯示不正確"> Wordpress圖像標題顯示不正確 </a> </li> <li> 26. <a href="http://hk.uwenku.com/question/p-riilkwvc-zt.html" target="_blank" title="HTML表標題顯示不正確"> HTML表標題顯示不正確 </a> </li> <li> 27. <a href="http://hk.uwenku.com/question/p-acahcblu-uy.html" target="_blank" title="Java動態頁面標題"> Java動態頁面標題 </a> </li> <li> 28. <a href="http://hk.uwenku.com/question/p-tzoxrqdh-ud.html" target="_blank" title="動態頁面標題"> 動態頁面標題 </a> </li> <li> 29. <a href="http://hk.uwenku.com/question/p-gqgxqaco-e.html" target="_blank" title="動態頁面標題"> 動態頁面標題 </a> </li> <li> 30. <a href="http://hk.uwenku.com/question/p-kgdvcpbo-ev.html" target="_blank" title="wordpress靜態頁面的標題不能正確呈現"> wordpress靜態頁面的標題不能正確呈現 </a> </li> </ul> </div> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1575177025"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="padding-top-10"></div> </div> </div> <script type="text/javascript" src="http://img.uwenku.com/uwenku/script/side.js?t=1644592048261"></script> <script type="text/javascript" src="http://img.uwenku.com/uwenku/plugin/highlight/highlight.pack.js"></script> <link href="http://img.uwenku.com/uwenku/plugin/highlight/styles/docco.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $('pre').each(function(i, e) { hljs.highlightBlock(e, "<span class='indent'> </span>", false) }); </script> <div class="col-lg-3 col-md-4 col-sm-5"> <div id="rightTop"> <div class="row"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="5415218910" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="row sidebar panel panel-default"> <div class="panel-heading font-bold"> 最新問題 </div> <div class="m-b-sm m-t-sm clearfix"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-hyvmiqdd-bgm.html" target="_blank" title="如何在模型從數據庫更新後保持實體代碼不變?"> 如何在模型從數據庫更新後保持實體代碼不變? </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-ccgjpxxv-bna.html" target="_blank" title="訪問從OpenCV的函數C++ NDK"> 訪問從OpenCV的函數C++ NDK </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-himxyfwg-bmt.html" target="_blank" title="在啓動時將/etc/profile.d/中的腳本作爲根執行?"> 在啓動時將/etc/profile.d/中的腳本作爲根執行? </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-cmvqqsie-bnw.html" target="_blank" title="試圖基於另一個數據透視一列"> 試圖基於另一個數據透視一列 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-ddluvwly-bnq.html" target="_blank" title="MongoDB Native Node.js問題"> MongoDB Native Node.js問題 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-vnnbjsyr-bnh.html" target="_blank" title="Tensorflow和CUDA版本"> Tensorflow和CUDA版本 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-poccepxy-bdn.html" target="_blank" title="是什麼,如果我可以通過安裝搬運工引擎"> 是什麼,如果我可以通過安裝搬運工引擎 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-dzmvluel-bhe.html" target="_blank" title="優化:值替換在數據幀wiith多個條件"> 優化:值替換在數據幀wiith多個條件 </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-ozzikgly-bgy.html" target="_blank" title="RxJava而不是改造回調"> RxJava而不是改造回調 </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-bogienfk-bhu.html" target="_blank" title="如何將php關聯數組排序爲特定順序?"> 如何將php關聯數組排序爲特定順序? </a> </li> </ul> </div> </div> </div> <p class="article-nav-bar"></p> <div class="row sidebar article-nav"> <div class="row box_white visible-sm visible-md visible-lg margin-zero"> <div class="top"> <h3 class="title"><i class="glyphicon glyphicon-th-list"></i> 相關問題</h3> </div> <div class="article-relative-content"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-cbrunokn-uc.html" target="_blank" title="PHP頁面標題標記顯示不正確"> PHP頁面標題標記顯示不正確 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-nqzjnbxg-ov.html" target="_blank" title="頁面顯示不正確"> 頁面顯示不正確 </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-unrtsopz-km.html" target="_blank" title="在動態頁面上獲取正確的頁面標題?"> 在動態頁面上獲取正確的頁面標題? </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-tuisggqo-kb.html" target="_blank" title="標題顯示不正確"> 標題顯示不正確 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-govivvpd-c.html" target="_blank" title="標題顯示不正確"> 標題顯示不正確 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-wkmzwnte-dc.html" target="_blank" title="啓動引導主題在Github頁面中顯示不正確"> 啓動引導主題在Github頁面中顯示不正確 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-sodhwzwo-bac.html" target="_blank" title="htaccess問題:標題投擲404雖然頁面正確顯示"> htaccess問題:標題投擲404雖然頁面正確顯示 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-vzstaimp-bmk.html" target="_blank" title="wp_title顯示頁面標題,但不顯示網站標題"> wp_title顯示頁面標題,但不顯示網站標題 </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-ydwrofar-rz.html" target="_blank" title="頁面邊框顯示不正確"> 頁面邊框顯示不正確 </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-dftkzdit-wn.html" target="_blank" title="路徑不顯示正確的頁面"> 路徑不顯示正確的頁面 </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div><!-- wrap end--> <!-- footer --> <footer id="footer"> <div class="bg-simple lt"> <div class="container"> <div class="row padder-v m-t"> <div class="col-xs-8"> <ul class="list-inline"> <li><a href="http://hk.uwenku.com/contact">聯系我們</a></li> <li>© 2020 HK.UWENKU.COM</li> <li><a target="_blank" href="https://beian.miit.gov.cn/">沪ICP备13005482号-4</a></li> <li><script type="text/javascript" src="https://v1.cnzz.com/z_stat.php?id=1280101193&web_id=1280101193"></script></li> <li><a href="http://www.uwenku.com/" target="_blank" title="优文库">简体中文</a></li> <li><a href="http://hk.uwenku.com/" target="_blank" title="優文庫">繁體中文</a></li> <li><a href="http://ru.uwenku.com/" target="_blank" title="поле вопросов и ответов">Русский</a></li> <li><a href="http://de.uwenku.com/" target="_blank" title="Frage - und - antwort - Park">Deutsch</a></li> <li><a href="http://es.uwenku.com/" target="_blank" title="Preguntas y respuestas">Español</a></li> <li><a href="http://hi.uwenku.com/" target="_blank" title="कार्यक्रम प्रश्न और उत्तर पार्क">हिन्दी</a></li> <li><a href="http://it.uwenku.com/" target="_blank" title="IL Programma di chiedere Park">Italiano</a></li> <li><a href="http://ja.uwenku.com/" target="_blank" title="プログラム問答園区">日本語</a></li> <li><a href="http://ko.uwenku.com/" target="_blank" title="프로그램 문답 단지">한국어</a></li> <li><a href="http://pl.uwenku.com/" target="_blank" title="program o park">Polski</a></li> <li><a href="http://tr.uwenku.com/" target="_blank" title="Program soru ve cevap parkı">Türkçe</a></li> <li><a href="http://vi.uwenku.com/" target="_blank" title="Đáp ứng viên">Tiếng Việt</a></li> <li><a href="http://fr.uwenku.com/" target="_blank" title="Programme interrogation Park">Française</a></li> </ul> </div> </div> </div> </div> </div> </footer> <!-- / footer --> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f78a970f17b19a79fc477a3378096f29"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </body> </html>