久艹网,亚洲一日韩欧美中文字幕2019,国产欧美日韩精品专区黑人,一区二区三区久久99

中山php|最優(yōu)網(wǎng)絡(luò)中山做網(wǎng)站 中山php建站

最優(yōu)良人

Posts Tagged With: php

php小偷程序,簡單的php采集代碼

2012/05/30 at 16:08 » Comments (289)

<?php function fetch_urlpage_contents($url){ $c=file_get_contents($url); return $c; } //獲取匹配內(nèi)容 function fetch_match_contents($begin,$end,$c) { $begin=change_match_string($begin); $end=change_match_string($end); $p = "{$begin}(.*){$end}"; if(eregi($p,$c,$rs)) { return $rs[1];} else { return "";} }//轉(zhuǎn)義正則表達(dá)式字符串 function change_match_string($str){ //注意,以下只是簡單轉(zhuǎn)義 //$old=array("/","$"); //$new=array("\/","\$"); $str=str_replace($old,$new,$str); return $str; } //采集網(wǎng)頁 function pick($url,$ft,$th) { $c=fetch_urlpage_contents($url); foreach($ft as $key => $value) { $rs[$key]=fetch_match_contents($value["begin"],$value["end"],$c); if(is_array($th[$key])) { foreach($th[$key] as $old => $new) { $rs[$key]=str_replace($old,$new,$rs[$key]); } } } return $rs; } $url="http://www.dgkai.cn"; //要采集的地址 $ft["title"]["begin"]="<title>"; //截取的開始點(diǎn) $ft["title"]["end"]="</title>"; //截取的結(jié)束點(diǎn) $th["title"]["中山"]="廣東"; //截取部分的替換 $ft["body"]["begin"]="<body>"; //截取的開始點(diǎn) $ft["body"]["end"]="</body>"; //截取的結(jié)束點(diǎn) $th["body"]["中山"]="廣東"; //截取部分的替換 $rs=pick($url,$ft,$th); ...more »

PHP預(yù)定義常量(內(nèi)部常量)DIRECTORY_SEPARATOR,PHP_VERSION,PHP_OS

2011/10/11 at 14:08 » Comments (2,738)

DIRECTORY_SEPARATOR 是PHP內(nèi)部常量,表示路徑分隔符 在win里為\ ,在linux 里為/PHP_VERSION這個(gè)內(nèi)建常量是 PHP 程序的版本,如 '3.0.8-dev'。PHP_OS這個(gè)內(nèi)建常量指執(zhí)行 PHP 解析器的操作系統(tǒng)名稱,如 'Linux'。預(yù)定義常量表內(nèi)核預(yù)定義常量這些常量在 PHP 的內(nèi)核中定義。它包含 PHP、Zend 引擎和 SAPI 模塊。 PHP_VERSION (string) PHP_OS (string) PHP_SAPI (string) 自 PHP 4.2.0 起可用。參見 php_sapi_name()。 PHP_EOL (string) 自 ...more »

php生成excel或者word文檔最簡單的方法

2011/09/29 at 16:29 » Comments (3,306)

以下代碼實(shí)現(xiàn)簡單輸出表格或者word文檔,如生成一個(gè)兩列的excel文檔,改動(dòng)相應(yīng)文件頭為 header("Content-type:application/vnd.msword"); header("Content-Disposition:filename=test.doc"); 就可以輸出.doc .xls等文件格式了 header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=test.xls"); echo "test1\t"; echo "test2\t\n"; //兩列之后換行 echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; echo "test1\t"; echo "test2\t\n"; 附一個(gè)文件格式對應(yīng)的數(shù)組 $mime_types = array( 'gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'bmp' => 'image/bmp', 'png' => 'image/png', 'tif' => ...more »

php獲取訪問者操作系統(tǒng)

2011/09/29 at 16:25 » Comments (258)

function osinfo() { $os=""; $Agent = $GLOBALS["HTTP_USER_AGENT"]; if (eregi('win',$Agent) && strpos($Agent, '95')) { $os="Windows 95"; } elseif (eregi('win 9x',$Agent) && strpos($Agent, '4.90')) { $os="Windows ME"; } elseif (eregi('win',$Agent) && ereg('98',$Agent)) { $os="Windows 98"; } elseif (eregi('win',$Agent) && eregi('nt 5\.0',$Agent)) { $os="Windows 2000"; } elseif (eregi('win',$Agent) ...more »

php獲取訪問者瀏覽器

2011/09/29 at 16:24 » Comments (5)

以下函數(shù)實(shí)現(xiàn)返回瀏覽者所使用的瀏覽器 function browse_infor() { $browser="";$browserver=""; $Browsers =array("Lynx","MOSAIC","AOL","Opera","JAVA","MacWeb","WebExplorer","OmniWeb"); $Agent = $GLOBALS["HTTP_USER_AGENT"]; for ($i=0; $i<=7; $i++) { if (strpos($Agent,$Browsers[$i])) { $browser = $Browsers[$i]; $browserver =""; } } if (ereg("Mozilla",$Agent) && !ereg("MSIE",$Agent)) { $temp =explode("(", $Agent); $Part=$temp[0]; $temp =explode("/", $Part); $browserver=$temp[1]; $temp =explode(" ",$browserver); $browserver=$temp[0]; $browserver =preg_replace("/([\d\.]+)/","\\1",$browserver); $browserver = ...more »

在IIS中運(yùn)行php,讓IIS支持php配置方法

2011/09/29 at 16:20 » Comments (270)

1、將 PHP 安裝為 ISAPI 模式: 在“控制面板”的“管理工具”中選擇“Internet 服務(wù)管理器”,打開 IIS 后停止服務(wù),然后在左側(cè)“默認(rèn)Web站點(diǎn)”上單擊右鍵選擇“屬性”,在打開的“默認(rèn) Web 站點(diǎn)屬性”窗口的“ISAPI 篩選器”標(biāo)簽里找到并點(diǎn)擊“添加”按鈕,在彈出的“篩選器屬性”窗口中的“篩選器名稱”欄中輸入:PHP,再將可執(zhí)行文件指向 php4isapi.dll 所在路徑,如:C:\PHP\sapi\php4isapi.dll。 2、打開“默認(rèn) Web 站點(diǎn)屬性”窗口的“主目錄”標(biāo)簽,找到并點(diǎn)擊“配置”按鈕,在彈出的“應(yīng)用程序配置”窗口中找到并點(diǎn)擊“添加”按鈕,在彈出的窗口中新增一個(gè)擴(kuò)展名映射,擴(kuò)展名為 .php,單擊“瀏覽”將可執(zhí)行文件指向 php4isapi.dll 所在路徑,如:C:\PHP\sapi\php4isapi.dll,然后一路確定即可。如果還想支持諸如 .php3,.phtml 等擴(kuò)展名的 PHP 文件,可以重復(fù)“添加”步驟。 3、再打開“默認(rèn) Web 站點(diǎn)屬性”窗口的“的“文檔”標(biāo)簽,找到并點(diǎn)擊“添加”按鈕,向默認(rèn)的 Web 站點(diǎn)啟動(dòng)文檔列表中添加 index.php 項(xiàng)。您可以將 index.php 升到最高優(yōu)先級,這樣,訪問站點(diǎn)時(shí)就會(huì)首先自動(dòng)尋找并打開 ...more »

Smarty模版中,數(shù)組的鍵名是一個(gè)變量的值,如何顯示該鍵名對應(yīng)的值

2011/09/08 at 16:45 » Comments (210)

題目有點(diǎn)繞口,大概的意思是 php已經(jīng)賦給模版一個(gè)數(shù)組,數(shù)組的信息如下: $config= array( 1=>'中山', 2=>'石岐' ); 數(shù)據(jù)庫存儲(chǔ)地區(qū)的字段記錄的是該數(shù)組的鍵名,如1,現(xiàn)在要在模版上顯示:中山。 如果這樣寫會(huì)報(bào)錯(cuò): {{$config.$row.region}} 模版上的正確的寫法是:{{$config[$row.region]}} 今天遇到的問題還更復(fù)雜一點(diǎn),數(shù)據(jù)庫字段存儲(chǔ)的是一些配置的序列化,所以在調(diào)取地區(qū)信息時(shí)還需要進(jìn)行反序列化處理,中間必須有一個(gè)賦值的過程: {{assign var=param value=$l.params|unserialize}} 然后$param.region就可以取得1這個(gè)值了 more »

FleaPHP如何定義表關(guān)聯(lián)以及關(guān)聯(lián)的簡寫

2011/09/06 at 18:06 » Comments (312)

定義從屬關(guān)聯(lián) 1、外鍵放置在主表中; 2、保存時(shí)不會(huì)自動(dòng)更新關(guān)聯(lián)表的記錄; 3、刪除時(shí)也不會(huì)更新關(guān)聯(lián)表的記錄。 示例: 多個(gè)文章都屬于某一個(gè)欄目。 格式一: * class Articles * { * var $belongsTo = array( * array( * ...more »

FleaPHP數(shù)據(jù)表關(guān)聯(lián)設(shè)置

2011/09/06 at 16:13 » Comments (365)

目前,F(xiàn)leaPHP支持四種類型的數(shù)據(jù)表關(guān)聯(lián),分別是: HAS_ONE: 當(dāng)前表的每一條記錄都擁有最多一條(0–1)關(guān)聯(lián)記錄 HAS_MANY: 當(dāng)前表的每一條記錄都擁有多條(0-n)關(guān)聯(lián)記錄 MANY_TO_MANY: 當(dāng)前表的每一條記錄都和其他表的多條(0-n)記錄關(guān)聯(lián) BELONGS_TO: 當(dāng)前表的每一條記錄都屬于另一個(gè)表的某條記錄 關(guān)聯(lián)中必須設(shè)置的屬性為: ‘name’, // 關(guān)聯(lián)的名字(如:hasOne、hasMany) ‘tableClass’, ...more »

FleaPHP的數(shù)據(jù)庫查詢條件匯總解析

2011/09/06 at 16:10 » Comments (274)

本文將全面分析FleaPHP的數(shù)據(jù)庫查詢條件,包含字符串格式,數(shù)組格式,混合格式,in查詢,or查詢,關(guān)聯(lián)查詢等常用查詢。 FleaPHP的數(shù)據(jù)庫查詢條件$conditions 參數(shù)可以是整數(shù)、字符串和數(shù)組三種類型: 1.如果 $conditions 參數(shù)是一個(gè)整數(shù),則假定該整數(shù)為主鍵字段值。 view plaincopy to clipboardprint? // 查詢主鍵字段值為1的記錄 $user = $tableUsers->find(1); 2.如果 $conditions 參數(shù)是一個(gè)字符串,則該字符串將直接作為查詢條件,這種方式可以支持最靈活的查詢條件。 例如: view plaincopy to clipboardprint? $conditions = 'id < 3' $user = $tableUsers->find($conditions); //生成的where字句為“WHERE id < 3” 3.1.如果 $conditions 參數(shù)是一個(gè)數(shù)組,且指定了鍵名和值,則查詢條件中字段名為鍵名,字段值等于鍵值。例如: // 查詢id字段值為3的記錄 $conditions = array( 'id' ...more »