Loading... 在typecho中发布的文章一般都是存在数据库里的,如果想要将博客迁移到Hexo/jekyll这样的静态博客还得挨个复制文章内容,十分的麻烦。 直到笔者发现了[NewbMiao大佬][1]写的转换脚本。 ### 转换! 整个步骤非常的简单,只需要如下三步: #### 下载转换脚本 进入想要存放提取出来的md文件目录,输入: ```shell wget https://raw.githubusercontent.com/NewbMiao/typecho2Hexo/master/converter.php ``` #### 修改数据库信息 ```shell nano converter.php ``` 你会看到如下的部分内容 ```php <?php // 运行 php converter.php $db = new mysqli(); // 根据实际情况更改 $db->connect('localhost','username','password','database'); $prefix = 'typecho_'; $sql = <<<TEXT select title,text,created,category,tags from {$prefix}contents c, ``` 将localhost,username,password,database,typecho_填写为你安装typecho时输入的信息。 #### 一键起飞! 输入 p<div class="tip inlineBlock info"> php converter.php </div> 就会发现文章都被提取出来了。 直接粘贴进hexo的_posts即可使用! [1]: https://github.com/NewbMiao Last modification:April 1st, 2020 at 04:31 pm © 允许规范转载 Support 原创不易,请我杯奶茶吧~ Appreciate the author 支付宝微信
3 comments
Mark
你好,修改信息中,database项应该填什么?
数据库名称