php實現點卡卡號密碼產生

/* 1.產生隨機數 2.插入表 3.查詢 4.返回yes */ function mak() //產生卡號密碼演算法 可替換; { $str=md5(microtime()); $pass=substr($str,-12); return $pass; } ///////////////產生卡號密碼並存入資料庫$times=你想添加的卡號密碼條數////////

php建立多級目錄的代碼

function create_dir($path,$mode) { if (is_dir($path)){ //判斷目錄存在否,存在不建立 echo "目錄'" . $path . "'已經存在"; } else { //不存在建立 $re=mkdir($path,$mode,true);

php實現簡單的源碼文法高亮函數

一個php實現的簡單文法高亮顯示的函數,注意:這個函數設計的比較簡單,可能對某些文法不能高亮顯示,你可以自己擴充該函數的功能 function syntax_highlight($code){ // this matches --> "foobar" $code = preg_replace( '/"(.*?)"/U', '"$1"', $code ); // hightlight functions and

將色彩轉換為其反色的PHP代碼

這段php代碼可以把一個顏色變成與之相反的顏色編碼,如:白色變成黑色,藍色變成黃色 function color_inverse($color){ $color = str_replace('#', '', $color); if (strlen($color) != 6){ return '000000'; } $rgb = ''; for ($x=0;$x $c = 255 - hexdec(substr($color,(2*$x),2));

PHP實現截取字串的通用方法

/** * 截取字串 * params $string 要截取的字串 * params $length: 保留長度(字元數) * params $dot: 多餘部分顯示**/function _cutstr($string, $length, $dot = ' ...') { if(strlen($string) return $string; } $string = str_replace(array('&', '"', ''), array('&',

PHP實現簡單的對稱式加密和解密方法

/** * 通用加密 * @param String $string 需要加密的字串 * @param String $skey 加密EKY * @return String */function enCode($string = '', $skey = 'echounion') { $skey = array_reverse(str_split($skey)); $strArr = str_split(base64_encode($string)); $strCount =

PHP實現防止sql注入的通用方法

function inject_check($sql_str) { return eregi('select|insert|and|or|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile', $sql_str);} function verify_id($id=null) { if(!$id) { exit('沒有提交參數!'); } elseif(inject_check($

通過php的 similar_text函數比較兩個字串的相似性

通過php的 similar_text函數比較兩個字串的相似性 $word2compare = "stupid"; $words = array( 'stupid', 'stu and pid', 'hello', 'foobar', 'stpid', 'upid', 'stuuupid', 'sstuuupiiid',); while(list($id, $str) = each($words)){ similar_text($str,

尋找頁面中所有連結的PHP代碼

function get_links($link) { $html = file_get_contents($link); $html = str_replace("\n", "", $html); $html = preg_replace('/ $html = preg_replace('//', "\n", $html); preg_match_all('/.*?/', $html, $matches); return($matches);}複製代碼

php date mktime strtotime 擷取時間方法

php date mktime strtotime 擷取時間方法 /** * 獲得系統年份數組 */function getSystemYearArr(){ $year_arr = array('2010'=>'2010','2011'=>'2011','2012'=>'2012','2014'=>'2014','2014'=>'2014','2015'=>'2015','2016'=>'2016','2017'=>'2017','2018'=>'2018','

php類型轉換

使用類型轉換,可以將一個變數的值轉換成另一種類型。這種轉換與c語言的類型轉換是相同的。只需在希望進行類型轉換的變數之前的圓括弧中插入需要轉換的臨時資料類型即可。例如:$totalqty = 0;$totalamount =

if() endif 替代文法

if(運算式):?> 語句endif?>複製代碼以上寫法是php的流程式控制制的替代文法。PHP 流程式控制制中有以下幾種替代文法:if,while,forforeach,switch替代文法的基本形式是:用冒號(:)替換流程式控制制語句中的左邊的開始的花括弧({),而右側的結尾的花括弧(})可以使用endif或endwhile或endfor或endforeach甚至endswitch替換。endif

【php教程】PHP中html word 互轉方法分享

在php開發中,php如何?html word互轉的呢?有什麼方法嗎?下面就給大家介紹php將html轉入word中的方法,這是經過測試的,這種方法有一點不好,html頁面代碼要寫在php中,不過好歹能運行,看程式'; }function save($path){echo "";$data = ob_get_contents();}function wirtefile($fn,$data){$fp=fopen($fp,$data);fwrite($fp,$data);}}$html=' 姓名

計算檔案大小的php代碼

function dirSize($directoty){ $dir_size=0; if($dir_handle=@opendir($directoty)) { while($filename=readdir($dir_handle)){ $subFile=$directoty.DIRECTORY_SEPARATOR.$filename; if($filename=='.

簡單的php抽獎代碼

/** * “抽獎”函數 * * @param integer $first 起始編號 * @param integer $last 結束編號 * @param integer $total 獲獎人數 * * @return string **/function isWinner($first, $last, $total){ $winner = array(); for ($i=0;;$i++) { $number =

將linux已耗用時間格式成易讀格式的php代碼

$exec = shell_exec('uptime'); $uptime = explode(' up ', $exec); $uptime = explode(',', $uptime[1]); if (strpos($uptime[0], 'day')) { $time = explode(':', $uptime[1]); echo('Current system uptime is ' . $uptime[0]. ', ' . $time[

PHP根據一個給定經緯度的點,進行附近地點查詢

實現原理先算出該點周圍的矩形的四個點,然後使用經緯度去直接匹配資料庫中的記錄。 //擷取周圍座標 public function returnSquarePoint($lng, $lat,$distance = 0.5){ $earthRadius = 6378138; $dlng = 2 * asin(sin($distance / (2 * $earthRadius)) / cos(deg2rad($lat))); $dlng =

php讀寫cookie的代碼

setcookie('mycookie','value'); //函數原型:int setcookie(string name,string value,int expire,string path,string domain,int secure) echo($mycookie); echo($HTTP_COOKIE_VARS['mycookie']); echo($_COOKIE['mycookie']); 刪除Cookie (1)調用只帶有name參數的setcookie(); (2

繁體和簡體互換的PHP函數

class utf8_chinese{ private $utf8_gb2312; private $utf8_big5; private $data; public function __construct($data){ $this->utf8_gb2312 = $data['sim']; $this->utf8_big5 =

PHP調用http介面

//http請求介面function curl_http_request($param,$url){ $ch = curl_init(); $curl_url = $url."?".$param; curl_setopt($ch, CURLOPT_URL, $curl_url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); //禁用認證 curl_setopt($ch,

總頁數: 5203 1 .... 3105 3106 3107 3108 3109 .... 5203 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.