導航:首頁 > 源碼編譯 > php個人網頁源碼

php個人網頁源碼

發布時間:2023-07-26 01:32:52

1. php網頁源碼下載後如何使用

  1. 下載後,最重要的是發布至伺服器上(外網的或者自己本地的)

  2. 網路上的php代碼,都需要伺服器的環境支持,所以需要,把代碼上傳至伺服器

    然後訪問該伺服器地址即可。

  3. 需要注意的是,有的時候可能需要另存為utf-8格式,再上傳。有的時候要檢查,是不是還需要資料庫的支持。


2. php 獲取網頁頭部信息和網頁和網頁源代碼查看

<?php
/**
* http下載類庫
*/
class Httplib{
// 目標網站無法打開時返回的錯誤代碼
var $_ERROR_CONNECT_FAILURE = 600;
// 自定義 UserAgent 字元串
var $_SEND_USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; LazyCMS.net::DownLoader)';
var $_url,$_method,$_timeout;
var $_scheme,$_host,$_port,$_path,$_query,$_referer;
var $_header;
var $_response;
/**
* 兼容PHP5模式
*
* @param 同下面的參數
*/
function __construct($url=null,$method='GET',$timeout=60){
@set_time_limit(0);
if (!empty($url)) {
$this->connect($url,$method,$timeout);
}
return $this;
}
/**
* 初始化對象
*
* @param string $url
* @param string $method
* @param int $timeout
* @return object
*/
function Httplib($url=null,$method='GET',$timeout=60){
return $this->__construct($url,$method,$timeout);
}
/**
* 改變連接url
*
* @param string $url
* @param string $method
* @param int $timeout
* @return object
*/
function connect($url=null,$method='GET',$timeout=60){
$this->_header = null;
$this->_response = null;
$this->_url = $url;
$this->_method = strtoupper(empty($method) ? 'GET' : $method);
$this->_timeout = empty($timeout) ? 30 : $timeout;
if (!empty($url)) {
$this->_parseURL($url);
}
return $this;
}
/**
* 發送請求
*
* @param array $params
* @return bool
*/
function send($params=array()) {
$header = null; $response = null; $QueryStr = null;
if (!empty($params)) { $this->_method = 'POST'; }
if (function_exists('fsockopen')) {
$fp = @fsockopen($this->_host,$this->_port,$errno,$errstr,$this->_timeout);
if (!$fp) { return false; }
$_port = ((int)$this->_port!==80) ? ':'.$this->_port : null;
$SendStr = "{$this->_method} {$this->_path}{$this->_query} HTTP/1.0\r\n";
$SendStr.= "Host:{$this->_host}{$_port}\r\n";
$SendStr.= "Accept: */*\r\n";
$SendStr.= "Referer:{$this->_referer}\r\n";
$SendStr.= "User-Agent: ".$this->_SEND_USER_AGENT."\r\n";
$SendStr.= "Pragma: no-cache\r\n";
$SendStr.= "Cache-Control: no-cache\r\n";
//如果是POST方法,分析參數
if ($this->_method=='POST') {
//判斷參數是否是數組,循環出查詢字元串
if (is_array($params)) {
$QueryStr = http_build_query($params);
} else {
$QueryStr = $params;
}
$length = strlen($QueryStr);
$SendStr.= "Content-Type: application/x-www-form-urlencoded\r\n";
$SendStr.= "Content-Length: {$length}\r\n";
}
$SendStr.= "Connection: Close\r\n\r\n";
if(strlen($QueryStr) > 0){
$SendStr.= $QueryStr."\r\n";
}
fputs($fp,$SendStr);
// 讀取 header
do{ $header.= fread($fp,1); } while (!preg_match("/\r\n\r\n$/",$header));
// 遇到跳轉,執行跟蹤跳轉
if ($this->_redirect($header)) { return true; }
// 讀取內容
while(!feof($fp)) {
$response.= fread($fp,4096);
}
fclose($fp);
} elseif (function_exists('curl_exec')) {
$ch = curl_init($this->_url);
curl_setopt_array($ch,array(
CURLOPT_TIMEOUT => $this->_timeout,
CURLOPT_HEADER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERAGENT => $this->_SEND_USER_AGENT,
CURLOPT_REFERER => $this->_referer,
));
if ($this->_method=='GET') {
curl_setopt($ch,CURLOPT_HTTPGET,true);
} else {
if (is_array($params)) {
$QueryStr = http_build_query($params);
} else {
$QueryStr = $params;
}
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$QueryStr);
}
$fp = curl_exec($ch);
curl_close($ch);
if (!$fp) { return false; }
$i = 0; $length = strlen($fp);
// 讀取 header
do{ $header.= substr($fp,$i,1); $i++; } while (!preg_match("/\r\n\r\n$/",$header));
// 遇到跳轉,執行跟蹤跳轉
if ($this->_redirect($header)) { return true; }
// 讀取內容
do {
$response.= substr($fp,$i,4096);
$i = $i + 4096;
} while ($length>=$i);
unset($fp,$length,$i);
}
$this->_header = $header;
$this->_response = $response;
return true;
}
/**
* 跟蹤跳轉
*
* @param string $header
* @return bool
*/
function _redirect($header){
if (in_array($this->status($header),array(301,302))) {
if(preg_match("/Location\:(.+)\r\n/i",$header,$regs)){
$this->connect(trim($regs[1]),$this->_method,$this->_timeout);
$this->send();
return true;
}
} else {
return false;
}
}
/**
* 取得請求的header
*
* @return string
*/
function header(){
return $this->_header;
}
/**
* 請求返回的html
*
* @return string
*/
function response(){
return $this->_response;
}
/**
* 返回狀態
*
* @param string $header
* @return int
*/
function status($header=null){
if (empty($header)) {
$header = $this->_header;
}
if(preg_match("/(.+) (\d+) (.+)\r\n/i",$header,$status)){
return $status[2];
} else {
return $this->_ERROR_CONNECT_FAILURE;
}
}
/**
* 解析url
*
* @param string $url
*/
function _parseURL($url){
$aUrl = parse_url($url);
$aUrl['query'] = isset($aUrl['query']) ? $aUrl['query'] : null;
$scheme = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : null;
$this->_scheme = ($scheme=='off' || empty($scheme)) ? 'http' : 'https';
$this->_host = isset($aUrl['host']) ? $aUrl['host'] : null;
$this->_port = empty($aUrl['port']) ? 80 : (int)$aUrl['host'];
$this->_path = empty($aUrl['path']) ? '/' : (string)$aUrl['path'];
$this->_query = strlen($aUrl['query']) > 0 ? '?'.$aUrl['query'] : null;
$this->_referer = $this->_scheme.'://'.$aUrl['host'];
}
}

$http = new Httplib('http://www..com');
$http->send();
$body = $http->response();
echo $body;

3. 我想獲取一個PHP網頁的源碼,並修改其中部分內容,需要用到什麼軟體

你在瀏覽器上只能獲取到php生成的html代碼,如果編輯html代碼可以使用dreamwave,如果你從下載平台下載的php代碼的文件,推薦使用phpstom編輯器,很不錯。

4. php網頁怎麼編輯源代碼

現在這個頁面沒有具體代碼 只有兩句話
第一句 定義個常數 值=1
第二具 引用一個文件 叫做 load.php
你需要去修改 load.php 頁面的代碼 所有輸出應該到在那個頁面中。

5. php獲取網頁源碼內容有哪些辦法

可以參考以下幾種方法:

方法一: file_get_contents獲取

<span style="white-space:pre"></span>$url="http://www..com/";

<span style="white-space:pre"></span>$fh= file_get_contents

('http://www.hxfzzx.com/news/fzfj/');<span style="white-space:pre"></span>echo $fh;

拓展資料

PHP(外文名:PHP: Hypertext Preprocessor,中文名:「超文本預處理器」)是一種通用開源腳本語言。語法吸收了C語言、Java和Perl的特點,利於學習,使用廣泛,主要適用於Web開發領域。PHP 獨特的語法混合了C、Java、Perl以及PHP自創的語法。它可以比CGI或者Perl更快速地執行動態網頁。

用PHP做出的動態頁面與其他的編程語言相比,PHP是將程序嵌入到HTML(標准通用標記語言下的一個應用)文檔中去執行,執行效率比完全生成HTML標記的CGI要高許多;PHP還可以執行編譯後代碼,編譯可以達到加密和優化代碼運行,使代碼運行更快。

6. 怎樣查看一個網頁的php源代碼

PHP是後端語言,前端是無法查看的,前端看到的是最終運算之後的結果,PHP源代碼是無法查看的。如果能直接查看PHP源代碼那還得了,如果你是單純想看看網頁代碼,那就在瀏覽器右鍵-查看源碼就可以看見。

7. 關於php網頁源碼的使用

首先,建議下載一個PHP環境安裝包。例如:phpnow、VertrigoServ、AppServ等。

安裝PHP環境後,在mysql資料庫里導入那個sql文件。

然後在PHP程序中找到資料庫信息代碼。修改資料庫名、資料庫用戶名、資料庫密碼等信息。

就可以運行了。

8. PHP網站源碼怎麼安裝

1.請先設置sql.php的資料庫連接

2..到phpmyadmin導入test.sql

3.導入完成後訪問後台admin/login.php

後台帳號admin後台密碼admin888

——————————————————

本不想洞液說,但看你安裝都如此又不得不講

網站並不是說一個程序安裝了能訪問了就算網站成功了

還有很多很多

——————————————————

的確能夠訪問一般人都叫做網站寬租

但網站本身的含義並非如此

而是一個過程不是一個物件

完整的網站包括搭建環境運維售後及運營策劃等等各環節

缺一不可

之所以遍地的程序卻並沒有遍地的成功者

就是因為太多人慎顫兆認為只要搭個架子自己就成功了

其實那隻是個基礎中的基礎而已連皮毛都不算...

真正想成為與同類完善的網站

要合適的程序良好的環境包括伺服器硬體運營環境軟體

完善的技術服務強有力的技術支撐

和整體的分析運營策劃

完善的規劃完善的流程執行和發展過程

這才叫做成功...

9. 要一個簡單的PHP購物網站源碼

購物商城類的開源代碼,可以用ECShop免費開源網店系統或者ThinkPHPshop開源商城系統來做,當然網上也有很多主題模板可以用。

ECShop比較適合來做簡單網店系統,個人或者企業做銷售產品用;

閱讀全文

與php個人網頁源碼相關的資料

熱點內容
dvd光碟存儲漢子演算法 瀏覽:757
蘋果郵件無法連接伺服器地址 瀏覽:962
phpffmpeg轉碼 瀏覽:671
長沙好玩的解壓項目 瀏覽:142
專屬學情分析報告是什麼app 瀏覽:564
php工程部署 瀏覽:833
android全屏透明 瀏覽:732
阿里雲伺服器已開通怎麼辦 瀏覽:803
光遇為什麼登錄時伺服器已滿 瀏覽:301
PDF分析 瀏覽:484
h3c光纖全工半全工設置命令 瀏覽:141
公司法pdf下載 瀏覽:381
linuxmarkdown 瀏覽:350
華為手機怎麼多選文件夾 瀏覽:683
如何取消命令方塊指令 瀏覽:349
風翼app為什麼進不去了 瀏覽:778
im4java壓縮圖片 瀏覽:362
數據查詢網站源碼 瀏覽:150
伊克塞爾文檔怎麼進行加密 瀏覽:890
app轉賬是什麼 瀏覽:163