如何解決php輸入框顯示原始碼?
這種情況一般是伺服器配置的問題,比如nginx沒有開啟php的模組,或者沒有安裝php
一般找到nginx。conf把php那塊前面的註釋去掉,重啟就行
location / {
index index。php index。html index。htm;
try_files $uri $uri/ /index。php?$args;
}
location ~ \。php$ {
#fastcgi_pass 127。0。0。1:9000;
fastcgi_pass unix:/home/php7/var/run/php-fpm。sock;
fastcgi_index index。php;
include fastcgi_params;
}
首先你要跑的是php指令碼,php環境是必須的!
瀏覽器只能解析靜態資源(js css html)
php檔案要依“。php”結尾。請看下這個流程 ,瞭解web開發,b/s互動流程。瞭解各個元件的任務角色。
這種情況一般是伺服器配置的問題,比如nginx沒有開啟php的模組,或者沒有安裝php
一般找到nginx。conf把php那塊前面的註釋去掉,重啟就行
location / {
index index。php index。html index。htm;
try_files $uri $uri/ /index。php?$args;
}
location ~ \。php$ {
#fastcgi_pass 127。0。0。1:9000;
fastcgi_pass unix:/home/php7/var/run/php-fpm。sock;
fastcgi_index index。php;
include fastcgi_params;
}
————河南新華