您好,登錄后才能下訂單哦!
php代碼如何將360瀏覽器導(dǎo)出的favdb的sqlite數(shù)據(jù)庫(kù)文件轉(zhuǎn)換為html,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。
給大家分享了一段php代碼,講解將360瀏覽器導(dǎo)出的favdb的sqlite數(shù)據(jù)庫(kù)文件轉(zhuǎn)換為html,下面代碼簡(jiǎn)單易懂,感興趣的朋友看一下吧。
php代碼如下所示:
<?php $book_mark_name = 'book_mark.html'; $content = file_get_contents('tb_fav.json'); var_dump($content); $content_list = json_decode($content,'utf-8'); $content_list = $content_list['RECORDS']; $content_header = "<!DOCTYPE NETSCAPE-Bookmark-file-1>". "<!-- This is an automatically generated file.It will be read and overwritten.Do Not Edit! -->". "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">". "<TITLE>Bookmarks</TITLE>". "<H1>Bookmarks</H1>". "<DL><p>"; file_put_contents($book_mark_name,$content_header); foreach ($content_list as $item) { $href = $item['url']; $add_date = $item['create_time']; $last_visit = $item['last_modify_time']; $last_modified = $item['last_modify_time']+1; $title = $item['title']; $content = "<DT><A HREF=\"$href\" ADD_DATE=\"$add_date\" LAST_VISIT=\"$last_visit\" LAST_MODIFIED=\"$last_modified\" LOVEFAV=\"0\" FAV_POS=\"1\" >$title</A>"."<br/>"; file_put_contents($book_mark_name,$content,FILE_APPEND); } $content_tail = "</DL><p>"; file_put_contents($book_mark_name,$content_tail,FILE_APPEND); echo 'success';
看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝您對(duì)億速云的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。