php網頁打開變原始碼 [論壇 - 伺服器架設]
正在瀏覽:
1 名遊客
php網頁打開變原始碼 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員一級
![]() ![]() 註冊日期:
2014/12/17 14:36 所屬群組:
已註冊使用者 等級: 3
HP : 0 / 63
![]() |
如下
getHeader()->sendHttpHeaders(); $response->disable(); if (! PMA_isValid($_REQUEST['url']) || ! preg_match('/^https:\/\/[^\n\r]*$/', $_REQUEST['url']) || ! PMA_isAllowedDomain($_REQUEST['url']) ) { PMA_sendHeaderLocation('./'); } else { // JavaScript redirection is necessary. Because if header() is used // then web browser sometimes does not change the HTTP_REFERER // field and so with old URL as Referer, token also goes to // external site. echo ""; // Display redirecting msg on screen. // Do not display the value of $_REQUEST['url'] to avoid showing injected content echo __('Taking you to the target site.'); } die();
2017/11/26 16:46
|
||||||||||
![]() |
回覆: php網頁打開變原始碼 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 37
HP : 0 / 905
![]() |
顏姒 寫到: 推測您的情況, 一種是您的網頁伺服器,沒有安裝跟PHP相關的模組(或是其他方式), 所以Request該頁,直接顯示該頁的內容,也就是PHP的原始碼。 若有PHP相關的模組,就會先透過PHP解譯過, 送回到瀏覽器,得到是PHP解譯過的內容,內容通常就會是HTML, 這樣瀏覽器,就會解譯HTML, 一般你看到網頁您看到的畫面,就是瀏覽器解譯HTML,所呈現的樣子, 複雜一點的,還有會有Javascript和CSS的影響。 另外一種情況,PHP程式碼,要放在「<?php」和「?>」之間。 例如 <?php phpinfo(); ?> 或是沒有結尾「?>」也可以 <?php phpinfo(); 若您沒有放在「<?php」和「?>」之間,就會視為是一般的文字內容, 沒有視為PHP程式碼,也就不會被伺服器上的PHP解譯過。 * http://php.net/manual/en/tutorial.firstpage.php * http://php.net/manual/en/language.basic-syntax.php * http://php.net/manual/en/language.basic-syntax.phptags.php * http://php.net/manual/en/install.php * https://help.ubuntu.com/lts/serverguide/web-servers.html * https://help.ubuntu.com/lts/serverguide/httpd.html * https://help.ubuntu.com/lts/serverguide/php.html 相關索引,紀錄在「[索引] Apache操作實務」。 以上提供參考 報告完畢 ![]()
2017/11/26 17:09
|
||||||||||
![]() |
回覆: php網頁打開變原始碼 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員一級
![]() ![]() 註冊日期:
2014/12/17 14:36 所屬群組:
已註冊使用者 等級: 3
HP : 0 / 63
![]() |
設定/etc/apache2/mods-enabled/php7.1.conf
<IfModule mod_userdir.c> <Directory /home/*/public_html> php_admin_flag engine On </Directory> </IfModule> php_admin_flag engine On (OFF)原本OFF 改On 重新啟動伺服器 就可以了 充新裝好像跟之前又變得複雜 設定是PHP7版本的關係嗎?
2017/11/27 21:37
|
||||||||||
![]() |
回覆: php網頁打開變原始碼 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 37
HP : 0 / 905
![]() |
補充參考連結
* http://php.net/manual/en/apache.configuration.php * http://php.net/manual/en/configuration.changes.php * http://php.net/manual/en/ini.list.php ![]()
2017/11/27 23:37
|
||||||||||
![]() |
回覆: php網頁打開變原始碼 |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員一級
![]() ![]() 註冊日期:
2014/12/17 14:36 所屬群組:
已註冊使用者 等級: 3
HP : 0 / 63
![]() |
謝謝分享 ^^
2017/11/28 19:19
|
||||||||||
![]() |
您可以查看帖子.
您不可發帖.
您不可回覆.
您不可編輯自己的帖子.
您不可刪除自己的帖子.
您不可發起投票調查.
您不可在投票調查中投票.
您不可上傳附件.
您不可不經審核直接發帖.