Time of Update: 2016-07-29
當一個目錄下有很多檔案時,伺服器的處理效能會變低,php預設的session僅僅存放在/tmp目錄下,未進行分級,當有一定的訪問量時,就存在效能問題了。首先,修改 php.ini的 session.save_path 選項修改如下:session.save_path = “2;/tmp/session” (去掉前面分號)表示把session存放在 “/tmp/session” 目錄下,並且分成 2
Time of Update: 2016-07-29
laopo單位需要常查詢組織機構代碼,但是她們單位的ip被人家屏蔽了,為了laopo查詢方便,特在阿里伺服器上配置了一個反向 Proxy,按如下配置即可成功。server { listen 80; #listen [::]:80; server_name laopo.xxxxx.net; index index.html index.htm index.php default.html default.htm default.php;
Time of Update: 2016-07-29
安裝dede UTF_8時報出了一個致命錯誤和警告,最後不能顯示網站後台和首頁了。報錯如下:登陸首頁顯示:Fatal error: Call to undefined function ParCv() in /include/dedesql.class.php on line 489登陸後台顯示:Deprecated: Function ereg_replace() is deprecated in /dede/config.php on line 2Fatalerror: Call to
Time of Update: 2016-07-29
HTML標籤相關聯的字串格式化如果用普通的post接收網頁輸入資訊";//echo stripslashes(addslashes($title))."";//echo htmlspecialchars($title);}?>這是我輸入1234的結果,但是細思恐極啊,我要是為了破壞你的網頁,傳進去壞壞的代碼怎麼辦?這時,我們的HTML標籤相關聯的字串格式化橫空出世stripslashes(addslashes($title))輸入什麼顯示什麼 刪除逸出字元
Time of Update: 2016-07-29
使用Acquia Dev Desktop嘗試安裝drupal8 的時候,採用預設參數報了一堆錯誤Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\InvalidArgumentException' with message 'The service definition "renderer" does not exist.' in
Time of Update: 2016-07-29
如何在同一台電腦上運行不同的PHP版本。如何更深的瞭解PHP運行機制。可以在學習別的語言的過程中,想想PHP是否也可以這樣做。ipython中定義獨立的設定項目 ipython profile create new_project 然後修改該配置下的ipython_config檔案。啟用的時候使用 ipython --profile=new_project
Time of Update: 2016-07-29
在Mac OS X中可以很方便的通過開啟“Web共用”啟用Apache服務: 設定方法如下: 開啟“系統設定偏好(System Preferences)” -> “共用(Sharing)” -> “Web共用(Web Sharing)”選中即可啟動Apache 有兩種方法: 開啟“系統設定偏好(System Preferences)” -> “共用(Sharing)” -> “Web共用(Web Sharing)”
Time of Update: 2016-07-29
在C語言中字串是作為位元組數組處理的。在Java語言中字串是作為對象處理的。而php則把字串作為基礎資料型別 (Elementary Data Type)來處理。通常對字串的處理涉及字串的格式化。字串的分割和串連、字串的比較、以及字串的尋找、匹配和替換。字串處理"; echo $str{0}.$str{1}.""; $s = ""; for($i=0; $i";
Time of Update: 2016-07-29
本文執行個體講述了php基於Fleaphp架構實現cvs資料匯入MySQL的方法。分享給大家供大家參考,具體如下:_getView(); $smarty->display("kaoqin_upload.html"); } //顯示錯誤 private function showErro(){ error_reporting(E_ALL); ini_set("display_errors","On"); } //判斷日期 private function isDate($file_name)
Time of Update: 2016-07-29
魔術方法是PHP物件導向中特有的特性。它們在特定的情況下被觸發,都是以雙底線開頭,你可以把它們理解為鉤子,利用模式方法可以輕鬆實現PHP物件導向中重載(Overloading即動態建立類屬性和方法)。魔術方法很多還是成對出現的,以下列出目前PHP中所有的模式方法。1.__construct,__destruct__constuct構建對象的時被調用;__destruct明確銷毀對象或指令碼結束時被調用;2.__get,__set__set當給不可訪問或不存在屬性賦值時被調用__get讀取不可訪問
Time of Update: 2016-07-29
今天由於工作的需求,需要擷取html標籤的屬性值,立即想到了Regex,標籤如下: 需要擷取標籤的cx、cy的屬性值,想了一會寫出了一個:$circle是上面的circle標籤的內容preg_match_all('/]*?cx\s*=\s*(\'|\")(.*?)\\1[^>]*?cy\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $circle,
Time of Update: 2016-07-29
序列化就是將變數資料轉換為字串(跟類型轉換機制不同),一般應用於儲存資料(檔案),然後在別的情形下恢複(還原序列化) 序列化:$val = serialize($var);file_put_contents('./*.txt',$val);還原序列化:$val = file_get_contents('./*.txt');$var = unserialize($val);當一個對象進行序列化操作時,會自動調用類中的__sleep();
Time of Update: 2016-07-29
調用usort()函數自訂排序函數,它必須接收兩個參數,第一個參數為要排序的數組,第二個參數為一個回呼函數,排序成功後返回true,失敗時返回false。 回呼函數接收兩個參數,返回false或者負數時表示第一個參數排在第二個參數前面,返回true或者正數時表示第一個參數排在第二個參數後面。代碼如下:').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().
Time of Update: 2016-07-29
一:首先來發布一個web servicepackage com.ws.service;public interface IUserService{public String getUserName(String id);}package com.ws.service;import javax.jws.WebMethod;import javax.jws.WebParam;import javax.jws.WebService;@WebServicepublic class
Time of Update: 2016-07-29
/** * 遠程擷取檔案大小 */ function getFileSize($url){ $url = parse_url($url);//返回url組成部分關聯陣列 if($fp = @fsockopen($url['host'],empty($url['port'])?80:$url['port'],$error)){ fputs($fp,"GET ".(empty($
Time of Update: 2016-07-29
背景行動裝置經常會發生使用者發送的內容中包含emoji表情,未經處理,在顯示時就是亂碼。解決方案1.資料庫支援:將Mysql的編碼從utf8轉換成utf8mb4。 2.匹配出內容中的emoji表情做過濾或替換/** * 表情轉換 更新到ios9.2涵蓋編碼範圍 * @param $str * @return mixed */public static function emoji_to_html($str) { $regex =
Time of Update: 2016-07-29
從今天起每天收集php面試資料,為了找個好工作,更為了技術提升。1. 簡述POST 和GET傳輸的最大容量分別是多少? Get受url長度限制,與瀏覽器和作業系統有關,例如IE對URL長度的限制是2083位元組(2K+35) Post的話限制取決於伺服器設定。 2.禁用COOKIE 後 SEESION 還能用嗎?
Time of Update: 2016-07-29
在apache下僅需要開啟重寫,並在網站根目錄添加重寫設定檔即可。 在nginx中,原理類似,需要對根路徑的訪問按條件進行URL重寫:server { listen80; server_name www.mysite.com; root /var/www/www.mysite.com; indexindex.html index.php; location / { if (!-e
Time of Update: 2016-07-29
自用的,不喜勿噴。自己安裝成功了。內容有摘自網路。1、安裝必備工具:$ yum -y install gcc gcc-c++ autoconf automake$ yum -y install zlib zlib-devel openssl openssl-devel pcre-devel 說明: pcre: 用來作地址修正的功能。zlib:nginx 的gzip模組,傳輸資料打包,省流量(但消耗資源)。openssl:提供ssl加密協議。 二、Nginx編譯安裝:1、下載Nginx:http:
Time of Update: 2016-07-29
'home.php', 'Contact' => 'contact.php', 'Services' => 'services.php', 'Site Map' => 'map.php' ); public function __set($name,$value){ $this->$name = $value;