複製代碼 代碼如下: //xml string $xml_string=" Foo foo@bar.com Foobar foobar@foo.com "; //load the xml string using simplexml $xml = simplexml_load_string($xml_string); //loop through the each node of user foreach ($xml->user as $user) { //access
實現原理: 就是對id對進行order by id desc 或 order by id asc進行排序,然後再判斷比當前id> or小於當前文章id的相同欄目的文章。 執行個體的sql語句如下: $id就是當面文章的id select * from news where idselect * from news where id>$id order by id desc limit 0,1 -- -- 表的結構 `string_find` -- CREATE TABLE IF NOT
複製代碼 代碼如下: /********************** *@file - path to zip file *@destination - destination directory for unzipped files */ function unzip_file($file, $destination){ // create object $zip = new ZipArchive() ; // open archive if ($zip->open($file) !==
複製代碼 代碼如下: /* creates a compressed zip file */ function create_zip($files = array(),$destination = '',$overwrite = false) { //if the zip file already exists and overwrite is false, return false if(file_exists($destination) && !$overwrite) { return
下面的例子簡單的示範了DOM對XML的操作,詳細解釋請看代碼中的注釋 <? /************************************************ ** use XML in PHP5 ** reference site: ** http://cn.php.net/manual/zh/ref.dom.php ** the follow codes need PHP5 support ****************************************
複製代碼 代碼如下:$num=1220.01; echo fmoney($num);//結果:1,220.21 echo umoney($num); //結果:ONE THOUSAND AND TWO HUNDRED TWENTY DOLLARS AND TWENTY-ONE CENTS ONLY echo umoney($num,"rmb"); //結果:ONE THOUSAND AND TWO HUNDRED TWENTY YUAN AND TWENTY-ONE FEN ONLY