Time of Update: 2016-07-25
/** * 根據html代碼擷取word文檔內容 * 建立一個本質為mht的文檔,該函數會分析檔案內容並從遠程下載頁面中的圖片資源 * 該函數依賴於類MhtFileMaker * 該函數會分析img標籤,提取src的屬性值。但是,src的屬性值必須被引號包圍,否則不能提取 * * @param string $content HTML內容 * @param string $absolutePath
Time of Update: 2016-07-25
php make page list ID 文章標題 /* * Created on 2010-4-17 * @link http://bbs.it-home.org* Order by Kove Wong */ $link=MySQL_connect('localhost','root','9922233344455'); mysql_select_db('pagelist'); mysql_query('set names gbk');$Page_size=10;$result=
Time of Update: 2016-07-25
mvc開發模式 MVC是一個設計模式,它強制性的使應用程式的輸入、處理和輸出分開。MVC應用程式被分成三個核心組件:模型、視圖、控制器。它們各自處理自己的任務。mvc開發模式 MVC是一個設計模式,它強制性的使應用程式的輸入、處理和輸出分開。MVC應用程式被分成三個核心組件:模型、視圖、控制器。它們各自處理自己的任務。 有必要嚴格區分mvc的三層模式模式嗎? m與c的跨界使用更有利於快速開發。 在我使用的架構中
Time of Update: 2016-07-25
訪問php程式時,報如下的錯誤:Parse error: syntax error, unexpected $end in D:\xampp\htdocs\guestBook\guestBook.php on line 330 看看程式 330行,代碼最後一行,這有什麼錯誤?找到了:訪問php程式時,報如下的錯誤:Parse error: syntax error, unexpected $end in D:\xampp\htdocs\guestBook\guestBook.php on
Time of Update: 2016-07-25
$DB_HOST ="localhost";$DB_LOGIN ="root";$DB_PASSWORD =" 123456";$conn=mysql_connect($DB_HOST,$DB_LOGIN,$DB_PASSWORD);複製代碼mysql_data_seek將內部查詢指標移動至查詢行上文法bool mysql_data_seek(resource result_indetifier,int row_number)樣本: $DB_HOST
Time of Update: 2016-07-25
$email = 'test@jbxue.com'; $domain = strstr($email, '@'); echo $domain; // 列印 @example.com $user = strstr($email, '@', true); // 從 PHP 5.3.0 起 echo $user; // 列印 yuxiaoxiao ?>複製代碼二、stristr strstr不區分大小寫版本三、strpos -尋找字串首次出現的位置int strpos ( string
Time of Update: 2016-07-25
/* test資料庫,一個test表,唯一欄位Id,作為測試使用 @link http://bbs.it-home.org*/ $conn = mysql_connect("localhost","root",""); $maxnum = 2; //每頁顯示記錄條數 mysql_select_db("test", $conn); $query1 = "SELECT COUNT(*) AS totalrows FROM test "; $result1 = mysql_query($query1,
Time of Update: 2016-07-25
// 上傳的CSV檔案,通常是用Excel編輯的GBK編碼, // 而原始碼是UTF-8,需要進行轉碼處理 file_put_contents($new_file, iconv('GBK', 'UTF-8', file_get_contents($new_file)));//ini_set('auto_detect_line_endings', true); // 設定地區:簡體中文,UTF-8編碼 setlocale(LC_ALL, 'zh_CN.UTF-8'); // 開啟CSV檔案
Time of Update: 2016-07-25
/** @檔案 yz.php @site http://bbs.it-home.org*/require_once('Auth.php'); function show_login_form () { echo ' username: password: ' ; } $options=array('dsn'=>'mysql://root:1@localhost/zs', 'table'=>'users', 'usernamecol'=>'user_name', 'passwordcol'=
Time of Update: 2016-07-25
$file="aa.php" ; $code=""; $f=fopen($file,"r+"); $content=fread($f,filesize($file)); fclose($f); if(!strstr($content,$code)){ $arrInsert = insertContent($file, $code, 3); unlink($file); foreach($arrInsert as $value) { file_put_contents($file, $value,
Time of Update: 2016-07-25
require 'dbconn.php';$sql = 'select * from _Test';$query = mssql_query($sql);while($row=mssql_fetch_row($query)){echo $row['UserId'].'::'.$row[1].'';}複製代碼返回:Notice: Undefined index: UserId in D:/_PHP_Test/Test2/test_connLocalDB.php on line 32
Time of Update: 2016-07-25
//此檔案用於快速測試UTF8編碼的檔案是不是加了BOM,並可自動移除 $basedir="."; //修改此行為需要檢測的目錄,點表示目前的目錄 $auto=1; //是否自動移除發現的BOM資訊。1為是,0為否。//link: http://bbs.it-home.org//以下不用改動 if ($dh = opendir($basedir)) { while (($file = readdir($dh)) !== false) { if ($file!='.' && $file!='..'
Time of Update: 2016-07-25
/* mysql_pager.class.php 三個參數:mysql_query()的結果, url變數page, 您要的每頁記錄數 */class mysql_pager { // define properties var $page; var $result; var $results_per_page = 3; var $total_pages;/* Define the methods下面是建構函式,和類同名(>php4),需要查詢的結果控制代碼,當前頁碼,每頁記錄數 like: $
Time of Update: 2016-07-25
複製代碼2、登入檢測頁面 checklogin.asp dim bLoginSavedif Request("SaveLogin") = "on" thenResponse.Cookies("SavedLogin")("EMail") = Request("email")Response.Cookies("SavedLogin")("pw") = Request("password")Response.Cookies("SavedLogin").Expires = Date +
Time of Update: 2016-07-25
/** 原廠模式的例子 @link http://bbs.it-home.org*/abstract class Operation{abstract public function getValue($num1,$num2);public function getAttr(){return 1;}}class Add extends Operation{public function getValue($num1, $num2){return $num1+$num2;}}class
Time of Update: 2016-07-25
$arr=str_split($str);$arr=array_count_values($arr);arsort($arr);print_r($arr);?> 複製代碼輸出:Array([$] => 7[3] => 6 => 6[4] => 5[f] => 5 => 4[d] => 4[5] => 3[a] => 3[6] => 2[2] => 2[g] => 2[#] =>
Time of Update: 2016-07-25
/** 功能:郵件發送 url: http://bbs.it-home.org*/header("content-type:text/html;charset=utf-8"); $smtp = array( "url" => "郵箱SMTP伺服器位址", "port" => "郵箱SMTP伺服器連接埠", // 一般為25 "username" => "使用者名稱", "password" => "密碼", "from" => "發件地址", "to" => "收件地址", "subject"
Time of Update: 2016-07-25
function sendHeader($num, $rtarr = null) { static $sapi = null; if ($sapi === null) { $sapi = php_sapi_name(); } return $sapi++; ?> 複製代碼看PW源碼的時候發現setHeader()函數中使用static關鍵字,很奇怪,以前也沒這樣用過。static用在函數裡面,聲明一次變數後,如果再次調用這個函數將會在初始值延續,如$sapi這裡將累加。 echo
Time of Update: 2016-07-25
/** * filename: ext_page.class.php * @package:phpbean * @author :feifengxlq * @copyright :Copyright 2006 feifengxlq * @license:version 2.0 * description: 分頁類,四種分頁模式 * 2.0增加功能:支援自訂風格,自訂樣式,同時支援PHP4和PHP5, * to see detail,please visit
Time of Update: 2016-07-25
$surl="http://bbs.it-home.org/";$gethtm = '首頁解決方案';echo formaturl($gethtm,$surl);?>複製代碼輸出:首頁解決方案--------- 示範執行個體 ------------原始路徑代碼:http://www.newnew.cn/newnewindex.aspx輸出示範代碼:http://www.maifp.com/aaa/test.php函數代碼: function formaturl($l1,$l2){if