Time of Update: 2016-07-29
複製代碼 代碼如下:/******************** *@file - path to file */ function force_download($file) { if ((isset($file))&&(file_exists($file))) { header("Content-length: ".filesize($file)); header('Content-Type: application/octet-stream');
Time of Update: 2016-07-29
說明 array array_flip ( array trans ) array_flip() 返回一個反轉後的 array,例如 trans 中的鍵名變成了值,而 trans 中的值成了鍵名。 注意 trans 中的值需要能夠作為合法的鍵名,例如需要是 integer 或者 string。如果值的類型不對將發出一個警告,並且有問題的鍵/值對將不會反轉。 如果同一個值出現了多次,則最後一個鍵名將作為它的值,所有其它的都丟失了。 array_flip() 如果失敗返回
Time of Update: 2016-07-29
複製代碼 代碼如下:/********************** *@filename - path to the image *@tmpname - temporary path to thumbnail *@xmax - max width *@ymax - max height */ function resize_image($filename, $tmpname, $xmax, $ymax) { $ext = explode(".", $filename); $ext = $ext[
Time of Update: 2016-07-29
ezSQL 下載地址: 下載 : ezSQL 新版本是2.05添加了很多支援,包括 CodeIgniter,MSSQL, PDO 等等 我之前也為 CodeIgniter 寫過一次,不過只支援 MySQL 看看使用樣本其實也沒什麼難度,直接看原始碼即可,主要是程式設計的思想很好。 Example 1 ---------------------------------------------------- // Select multiple records from the database
Time of Update: 2016-07-29
寫入過程複製代碼 代碼如下:// Get the path of the configuration file $fname = JPATH_CONFIGURATION.DS.'configuration.php'; // clear cache $cache = JFactory::getCache(); $cache->clean(); // Update the credentials with the new settings $config =&
Time of Update: 2016-07-29
比如第一次請求一個檔案的從0到999位元組,第二次請求1000到1999位元組,以此類推,每次請求1000位元組的內容,然後程式通過fseek函數去取得對應的檔案位置,然後輸出。 複製代碼 代碼如下:$fname = './05e58c19552bb26b158f6621a6650899'; $fp = fopen($fname,'rb'); $fsize = filesize($fname); if (isset($_SERVER['HTTP_RANGE']) &&
Time of Update: 2016-07-29
編碼範圍1. GBK (GB2312/GB18030)\x00-\xff GBK雙位元組編碼範圍 \x20-\x7f ASCII \xa1-\xff 中文 \x80-\xff 中文 2. UTF-8 (Unicode)\u4e00-\u9fa5 (中文) \x3130-\x318F (韓文 \xAC00-\xD7A3 (韓文) \u0800-\u4e00 (日文) ps: 韓文是大於[\u9fa5]的字元正則例子: preg_replace(”/([\x80-\xff])/”,”",$str);
Time of Update: 2016-07-29
推薦函數:一是PHP擷取當前頁面的網址: dedecms也是用的這個複製代碼 代碼如下://獲得當前的指令碼網址 function GetCurUrl() { if(!empty($_SERVER["REQUEST_URI"])) { $scriptName = $_SERVER["REQUEST_URI"]; $nowurl = $scriptName; } else { $scriptName = $_SERVER["PHP_SELF"]; if(empty($_SERVER["QUERY_
Time of Update: 2016-07-29
php檔案複製代碼 代碼如下:class xpathExtension{ public static function getNodes($domDoc, $xpathString) { $xp = new DOMXPath($domDoc); $xp->registerNamespace('x', 'http://www.w3.org/1999/xhtml'); $xp->registerNamespace('xhtml', 'http://www.w3.org/1999/xhtml'); $
Time of Update: 2016-07-29
1.php-excelphp-excel is a very simple library for generating excel documents from php on-the-fly.http://code.google.com/p/php-excel/本站下載http://www.jb51.net/codes/24319.html2.PHPExcelProject providing a set of classes for the PHP programming language,
Time of Update: 2016-07-29
這樣我們就可以拿此函數來做很多用途了,比如:單點登入的token加密傳輸啦,臨時密碼啦等等複製代碼 代碼如下:/** * @param string $string 原文或者密文 * @param string $operation 操作(ENCODE | DECODE), 預設為 DECODE * @param string $key 密鑰 * @param int $expiry 密文有效期間, 加密時候有效, 單位 秒,0 為永久有效 * @return string 處理後的 原文或者
Time of Update: 2016-07-29
複製代碼 代碼如下:/** 預設首頁 **/ class DefaultController extends AppController { public function index() { $len = 5; $str = "ABCDEFGHIJKLNMPQRSTUVWXYZ123456789"; $im = imagecreatetruecolor ( 70, 20 ); $bgc = imagecolorallocate($im, 255, 255, 255); $bgtxt =
Time of Update: 2016-07-29
過去建站一般都自訂開發,這需要技術性很高,而且代碼不容易複用,別人也不容易維護,對於CMS來說,實在是沒有必要自訂開發,因為CMS的準系統並不多,很多功能都應該被複用。而joomla是一個完整的CMS,而且它最大特點是擴充性很好。
Time of Update: 2016-07-29
PHP 7安裝memcached報錯提示: memcached-2.2.0/php_memcached_private.h:44:40: fatal error: ext/standard/php_smart_str.h: No such file or directory #include ').addClass('pre-numbering').hide();
Time of Update: 2016-07-29
require 的使用方法如 require("MyRequireFile.php"); 。這個函數通常放在 PHP 程式的最前面,PHP 程式在執行前,就會先讀入 require 所指定引入的檔案,使它變成 PHP 程式網頁的一部份。常用的函數,亦可以這個方法將它引入網頁中。 include 使用方法如 include("MyIncludeFile.php"); 。這個函數一般是放在流程式控制制的處理部分中。PHP 程式網頁在讀到 include
Time of Update: 2016-07-29
Example 5-8. date_format[日期格式] index.php: 複製代碼 代碼如下:$smarty = new Smarty; $smarty->assign('yesterday', strtotime('-1 day')); $smarty->display('index.tpl'); index.tpl: {$smarty.now|date_format} {$smarty.now|date_format:"%A, %B %e, %Y"}
Time of Update: 2016-07-29
1.先到網上下載phpmyadmin,再解壓到可以訪問的web目錄下(如果是虛擬空間,可以解壓後通過ftp等上傳到web目錄下),當然您可以修改解壓後該檔案的名稱。2.配置config檔案 開啟libraries下的config.default.php檔案,依次找到下面各項,按照說明配置即可:A.訪問網址$cfg['PmaAbsoluteUri'] = '';這裡填寫phpmyadmin的訪問網址B.mysql主機資訊$cfg['Servers'][$i]['host'] =
Time of Update: 2016-07-29
建立一個名為yz.php的頁面 複製代碼 代碼如下:require_once('Auth.php'); function show_login_form () { echo ' username: password: ' ; } $opti//root:1@localhost/zs', 'table'=>'users', 'usernamecol'=>'user_name', 'passwordcol'=>'user_passwd', 'cryptType'=>'', 'db_fields'=
Time of Update: 2016-07-29
定義和用法clearstatcache()函數的作用是:清除檔案狀態緩衝。 PHP的快取資料對更快更好的運行函數是非常有利的。如果一個檔案在指令碼中測試了多次,你也許會禁止對正確的結果進行緩衝。為了實現這點,你可以使用clearstatcache()函數。 文法 clearstatcache()提示和注意 提示:執行緩衝的函數: stat() lstat() file_exists() is_writable() is_readable() is_executable() is_file()
Time of Update: 2016-07-29
它是通過 Session ID 來判斷的,什麼是 Session ID,就是那個 Session 檔案的檔案名稱,Session ID 是隨機產生的,因此能保證唯一性和隨機性,確保Session 的安全。一般如果沒有設定 Session 的生存周期,則 Session ID 儲存在記憶體中,關閉瀏覽器後該 ID 自動登出,重新請求該頁面後,重新註冊一個 Session ID。 如果用戶端沒有禁用 Cookie,則 Cookie 在啟動 Session 會話的時候扮演的是儲存 Session