zl程序教程

您现在的位置是:首页 >  其他

当前栏目

搭建typecho1.2版本小程序

程序 版本 搭建 typecho1.2
2023-06-13 09:16:31 时间

前言

Typecho在前阵子迎来了1.2版本的更新 同时uniapp也进行了重做更新

故老版本的小程序已经无法正常运行

安装

搭建typecho小程序版

前言最近和朋友聊天聊到小程序就有感而发,可不可以将typecho也做成微信小程序?于是乎GitHub简单找了一下,...

我先前这篇有详细的教程

问题

Typecho小程序1.2版本适配方案
/**
     * 抛出ajax的回执信息
     *
     * @access public
     * @param string $message 消息体
     * @return void
     */
    public function throwXml($message)
{
        /** 设置http头信息 */
        $this->setContentType('text/xml');

        /** 构建消息体 */
        echo '<?xml version="1.0" encoding="' . $this->getCharset() . '"?>',
        '<response>',
        $this->_parseXml($message),
        '</response>';

        /** 终止后续输出 */
        exit;
    }

    /**
     * 抛出json回执信息
     *
     * @access public
     * @param mixed $message 消息体
     * @return void
     */
    public function throwJson($message)
{
        /** 设置http头信息 */
        $this->setContentType('application/json');

        echo json_encode($message);

        /** 终止后续输出 */
        exit;
    }

代码位置在var/Typecho/Response.php中,如果想要在1.2版本中使用插件,只需要将代码加入到1.2版本的该文件中就可以了

其他配置方法就和之前的是一样的了,注意一定要关闭php7.2版本的display_errors报错功能,不然也不会成功。

Typecho小程序1.2版本来自网络