typecho博客的相对地址实现

typecho其中的博客地址,必须写上绝对地址,否则在迁移网址的时候会出现问题,例如页面记载异常

修改其中的

typecho\var\Widget\Options\General.php 中的165行左右,

/** 站点地址 */if (!defined('TYPECHO_SITE_URL')) { $siteUrl = new Form\Element\Text('siteUrl',null, $this->options->originalSiteUrl, _t('站点地址'), _t('站点地址主要用于生成内容的永久链接.') . ($this->options->originalSiteUrl == $this->options->rootUrl ?'' : '

' . _t('当前地址 %s 与上述设定值不一致', $this->options->rootUrl)) ); $siteUrl->input->setAttribute('class', 'w-100 mono'); $form->addInput($siteUrl->addRule('required', _t('请填写站点地址')) ->addRule('url', _t('请填写一个合法的URL地址'))); }

改成  ->addRule('xssCheck', _t('请填写一个合法的URL地址'))); 即可实现

posted @ 2024-09-20 11:29  Damon'log  阅读(127)  评论(0)    收藏  举报