Time of Update: 2016-07-29
1、PHP的iconv擴充:處理字元集轉換的介面。 系統查看安裝的iconv擴充中包含字元編碼集:iconv -l 擴充模組包含的函數: iconv_get_encoding()//擷取iconv內部配置資訊 iconv_mime_decode_headers()//解碼多個MIME headers iconv_mime_decode()//解碼一個MIME header iconv_mime_encode()//壓縮一個MIME header
Time of Update: 2016-07-29
字元集:是描述圖形或者文字在傳輸的時候使用的編碼稱之為字元集。圖形或者文字與編碼之間的關係:就像是下面這樣:“字”=>10010001
Time of Update: 2016-07-29
1、在開發SSH項目時,nginx佈建服務時,沒把action也配置進去,nginx沒有轉寄action請求。原來如下:#JSP直接給tomcat處理,因為nginx並不是servlet容器,沒辦法處理JSPlocation ~ .*\.(jsp|do)$ {proxy_pass http://mysvr ;#以下是一些反向 Proxy的配置可刪除.proxy_redirect
Time of Update: 2016-07-29
對象 private $sId = 1; //servier服務ID private $con = null;//連結資源 /** * 初始化Redis * * @return Object */ public function __construct() { if ( !class_exists('Redis') ) { throw new QException('PHP extension
Time of Update: 2016-07-29
更多請支援:http://www.webyang.net/Html/web/article_174.html一:redis安裝Download, extract and compile Redis with:$ wget http://download.redis.io/releases/redis-3.0.4.tar.gz$ tar xzf redis-3.0.4.tar.gz$ cd redis-3.0.4$ makeThe binaries that are now compiled
Time of Update: 2016-07-29
執行個體代碼$ch = curl_init();curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER=>true, CURLOPT_POST=>true, CURLOPT_HEADER=>false, CURLOPT_TIMEOUT=>30, CURLOPT_HTTPHEADER=>["Content-type:application/json"],
Time of Update: 2016-07-29
php使用session來儲存使用者登入資訊使用session儲存頁面登入資訊1、資料庫連接配置頁面:connectvars.php2、登入頁面:logIn.php串連資料庫的相關資訊require_once 'connectvars.php';//開啟一個會話session_start();$error_msg = "";//如果使用者未登入,即未設定$_SESSION['user_id']時,執行以下代碼if(!isset($_SESSION['user_id'])){
Time of Update: 2016-07-29
在項目中用到的RSS 2.0版本的php產生類。只需要根據資料結構吧資料輸入進去就能產生一個xml檔案,並通過函數輸出。/** * Rss產生模組 * @author JerryLi (@lijian@dzs.mobi) * @see 協議說明 RSS規範遵循 2.0 * http://jyjsjd.iteye.com/blog/1543483 * http://rayleeya.iteye.com/blog/372802 */final class CRssBuilder{ /*
Time of Update: 2016-07-29
下載了一個名為NetBeans的IDE開發PHP程式,當我輸入常用的的$name = $_GET['name'];時卻收到警告:請不要直接存取超全域$_GET數組 請改用某些過濾函數(例如filter_input() ,帶有is_*()函數的條件等)。我這才明白其實我一貫的做法並不規範。實際上改成下面的形式就能夠消除警告了:$name = "";if(is_string($_GET['name'])){$name = strval($_GET['name']);}
Time of Update: 2016-07-29
對於stristr()函數,在此我只用執行個體來說明:參數描述string必須,被搜尋的字串search必須 , 要搜尋的字串before_search可選,預設false,返回字串在string字串中第一次出現,本身以及其結尾的剩餘部分;true,返回字串第一次出現之前的字串部分註:stristr()函數不區分,字串大小寫,如果要區分大小寫,請用strstr() 函數For Example:one:echo stristr("google earch!!!",earch);output:
Time of Update: 2016-07-29
laravel 5.1裡用 laravel自己的功能搞的登入,它登入後預設是跳轉到 home 這個地址,基本上這已經夠用了。只不過我想讓它跳到指定的其它地址, 比如 admin.那麼要怎麼做?很簡單:" app/Http/Controllers/Auth/AuthController.php" 這個檔案,加上 protected $redirectPath = 'admin'; 重新登入下,成功了。
Time of Update: 2016-07-29
/* @author Dishy 資料庫封裝 */ class mysqldb{private$host;private$username;private$password;private$dbname;private$sql;private$select = true;private$result;private$array;publicfunction__construct($host,$username,$password,$dbname){ $this->host = $host;
Time of Update: 2016-07-29
parse_url()本函數解析一個 URL 並返回一個關聯陣列,包含在 URL 中出現的各種組成部分。本函數不是用來驗證給定 URL 的合法性的,只是將其分解為下面列出的部分。不完整的 URL 也被接受,parse_url() 會嘗試盡量正確地將其解析。 $_url = "http://www.baidu.com/web?id=15&page=5"; $_par = pares_url($_url); var_dump($_par);輸出結果:array(4) {
Time of Update: 2016-07-29
mamp 上PHP用的是 5.5.26等,編譯 memcache 模組需要用到 php 源碼,mamp 不內建,到 php 官網下一個 php-5.5.26.tar.gz,解壓後,產生 zend_config.h 備用tar -zxvf php-5.5.26.tar.gzcd php-5.5.26./configure 如果報錯 根據提示需要安裝依賴 例如:zlib 單獨另下 同樣解壓 需要--prefix-dir=制定路徑下載並編譯:curl -O
Time of Update: 2016-07-29
使用PHP
Time of Update: 2016-07-29
下面是cocos2d-js請求網路資料的代碼:var HttpRequest = { /* * 網路請求之GET * url 請求的網路地址 * callback 回調參數 * */ GET:function(url,callback){ var xhr = cc.loader.getXMLHttpRequest(); xhr.open("GET",url,true);
Time of Update: 2016-07-29
var http = require('http'), httpProxy = require('http-proxy'); // 建立一個代理 Proxy Server 對象var proxy = httpProxy.createProxyServer({}); // 捕獲異常proxy.on('error', function (err, req, res) { res.writeHead(500, { 'Content-Type
Time of Update: 2016-07-29
function http_post_data($url, $data_string) { $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
Time of Update: 2016-07-29
全部純靜態化 — 局部純靜態化實現步驟:1. 編寫介面//熱門排行榜介面資料//1. 擷取資料//2. 把我們擷取到的資料群組裝成介面資料提供通訊//串連資料庫require_once('./db.php');$connect = Db::getInstance()->connect();$sql = 'select * from hit as a join news as b on a.news_id=b.id order by a.count desc limit 3';$result =
Time of Update: 2016-07-29
define(EARTH_RADIUS, 6371);//地球半徑,平均半徑為6371km /** *計算某個經緯度的周圍某段距離的正方形的四個點 * *@param lng float 經度 *@param lat float 緯度 *@param distance float 該點所在圓的半徑,該圓與此正方形內切,預設值為0.5千米 *@return array 正方形的四個點的經緯度座標 */ function returnSquarePoint($lng, $lat,$distance