Heim  >  Artikel  >  php教程  >  将360 浏览器导出的favdb的sqlite数据库文件转换为html

将360 浏览器导出的favdb的sqlite数据库文件转换为html

大家讲道理
大家讲道理Original
2016-11-09 14:26:082203Durchsuche

<?php
    $book_mark_name = &#39;book_mark.html&#39;;
    $content = file_get_contents(&#39;tb_fav.json&#39;);
    var_dump($content);
    $content_list = json_decode($content,&#39;utf-8&#39;);
    $content_list = $content_list[&#39;RECORDS&#39;];
 
    $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[&#39;url&#39;];
        $add_date       = $item[&#39;create_time&#39;];
        $last_visit     = $item[&#39;last_modify_time&#39;];
        $last_modified  = $item[&#39;last_modify_time&#39;]+1;
        $title          = $item[&#39;title&#39;];
        $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 &#39;success&#39;;

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php 人民币金额转大写程序Nächster Artikel:CURL缓存远程文件类