<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title><![CDATA[30o漫笔]]></title> 
<atom:link href="http://www.30o.top/rss.php" rel="self" type="application/rss+xml" />
<description><![CDATA[30o漫笔-分享优质资源！]]></description>
<link>http://www.30o.top/</link>
<language>zh-cn</language>
<generator>emlog</generator>

<item>
    <title>wordpress升级6.9后SMTP邮件发送失败！</title>
    <link>http://www.30o.top/post-8.html</link>
    <description><![CDATA[<p>WordPress最新版会导致网站SMTP发信失败的原因以及修复方式，技术宅发现网站升级到WordPress6.9版本后网站的SMTP发信会失败，报错如下：<br>MAIL FROM command failed,mail from address must be same as authorization user ,501<br>1 、邮件发送失败：WordPress 6.9 已修复核心邮件函数中的信封发件人问题，但如果问题持续，可能源于服务器配置或插件冲突。建议优先配置 SMTP 服务以提升可靠性。下面是以腾讯云的 SMTP 配置为例，将其添加到主题 function.php 或者保存为 .php 放到插件目录即可。</p>
<p>/**<br>*修复SMTP发件人与发件人地址匹配的问题<br>*这确保了阿里云阿里云,QQ，163，SMTP身份验证正常工作<br>*/<br>add_action(&lsquo;phpmailer_init&rsquo;, function($phpmailer) {<br>// Only fix if using SMTP<br>if ($phpmailer-&gt;Mailer === &lsquo;smtp&lsquo;) {<br>// 将发件人设置为与发件人地址匹配，以满足阿里云,QQ，163等SMTP要求<br>if (empty($phpmailer-&gt;Sender) || $phpmailer-&gt;Sender !== $phpmailer-&gt;From) {<br>$phpmailer-&gt;Sender = $phpmailer-&gt;From;<br>}<br>}<br>}, 10002);</p>]]></description>
    <pubDate>Wed, 25 Feb 2026 01:32:01 +0800</pubDate>
    <dc:creator>30o漫笔</dc:creator>
    <guid>http://www.30o.top/post-8.html</guid>
</item>
<item>
    <title>PHP获取网页标题和内容信息接口</title>
    <link>http://www.30o.top/post-7.html</link>
    <description><![CDATA[<p>PHP获取网页标题和内容信息接口<br>$url = filter(get(&lsquo;url&rsquo;));<br>if (!$url) {<br>return json([&lsquo;code&rsquo; =&gt; -1, &lsquo;msg&rsquo; =&gt; &lsquo;链接不能为空！&rsquo;]);<br>} else if (get_curl($url) === false) {<br>return json([&lsquo;code&rsquo; =&gt; -1, &lsquo;msg&rsquo; =&gt; &lsquo;提交的网址无法访问！&rsquo;]);<br>}<br>$data =&nbsp;<a title="查看所有文章关于 get" href="https://www.xmy7.com/tag/get" target="_blank" rel="noopener">get</a>_c<a title="查看所有文章关于 url" href="https://www.xmy7.com/tag/url" target="_blank" rel="noopener">url</a>($url);<br>//Title<br>preg_match(&lsquo;/</p>]]></description>
    <pubDate>Wed, 25 Feb 2026 01:29:27 +0800</pubDate>
    <dc:creator>30o漫笔</dc:creator>
    <guid>http://www.30o.top/post-7.html</guid>
</item>
<item>
    <title>WordPress网站免插件实现上传图片自动转为WebP格式</title>
    <link>http://www.30o.top/post-5.html</link>
    <description><![CDATA[<p>&nbsp;用一段php代码，免插件的方式，实现图片上传WordPress网站，自动将JPEG、PNG转换为WebP格式图片。大大提高网站文章编辑的效率。之前我在写文章的时候，上传图片到网站的流程是先手动把本地的图片到一些站点，比如Squoosh、TinyPNG，进行WebP格式转化压缩，之后再手动上传到网站。这个过程实际上非常耗时，且机械重复没什么技术含量。一直想着有什么方法可以上传图片到网站的过程中自动就把这些活干了，省时省力。以前也尝试过一些插件，要么免费额度太少，要么过多的插件影响网站速度。</p>
<p><strong>代码功能</strong><br>将上传的 JPEG(JPG)、PNG 格式图片自动转换成 WEBP 格式，<br>可选功能一：删除原图片<br>可选功能二：禁止生成其他尺寸的缩略图<br><strong>代码教程</strong><br>子比主题：将下方代码加入/wp-content/themes/zibll/functions.php文件或者func.php文件中（两个文件性质一样，只是 func.php 子比主题更新不会被覆盖掉，也就不需要再次修改），注意加在 &lt;?php 的后面</p>
<p>其他注意也是一样</p>
<p>/** * WordPress自动将上传图片转换为WebP格式,同时删除原文件 * 图像质量默认为80%，可根据需要调整 */ add_filter('wp_handle_upload', 'auto_convert_to_webp');function auto_convert_to_webp($upload) { &nbsp; &nbsp;// 检查是否为支持的图片格式 &nbsp; &nbsp;if (in_array($upload['type'], ['image/jpeg', 'image/png'])) { &nbsp; &nbsp; &nbsp; &nbsp;$file_path = $upload['file']; &nbsp; &nbsp; &nbsp; &nbsp;$quality = 80; // 可调整质量参数，建议70-90% &nbsp; &nbsp; &nbsp; &nbsp;// 检查服务器是否支持图像处理 &nbsp; &nbsp; &nbsp; &nbsp;if (extension_loaded('imagick') || extension_loaded('gd')) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$image_editor = wp_get_image_editor($file_path);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!is_wp_error($image_editor)) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 生成WebP文件路径 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$webp_path = preg_replace('/\.[^.]+$/', '.webp', $file_path);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 保存为WebP格式 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$image_editor-&gt;save($webp_path, 'image/webp');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 更新上传信息指向WebP文件 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$upload['file'] = $webp_path; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$upload['type'] = 'image/webp'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$upload['url'] = preg_replace('/\.[^.]+$/', '.webp', $upload['url']);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 删除原始文件（可选） &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @unlink($file_path); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp;} &nbsp; &nbsp;return $upload;}//禁止生成缩略图（不需要将下面的全部删除）function luesuotu( $sizes ){ &nbsp;unset( $sizes[ 'thumbnail' ]); &nbsp;unset( $sizes[ 'medium' ]); &nbsp;unset( $sizes[ 'medium_large' ] ); &nbsp;unset( $sizes[ 'large' ]); &nbsp;unset( $sizes[ 'full' ] ); &nbsp;unset( $sizes['1536x1536'] ); &nbsp;unset( $sizes['2048x2048'] ); &nbsp;return $sizes;}<br>add_filter( 'intermediate_image_sizes_advanced', 'luesuotu' );</p>
<p>不需要删除原图，可将此段代码删除或注释掉 @unlink($file_path);</p>
<p>不需要禁用生成缩略图，可将 //禁止生成缩略图 以下的代码全部删除</p>]]></description>
    <pubDate>Tue, 09 Dec 2025 20:13:52 +0800</pubDate>
    <dc:creator>30o漫笔</dc:creator>
    <guid>http://www.30o.top/post-5.html</guid>
</item>
<item>
    <title>WordPress换域名、批量修改替换网站链接URL最完美教程[新手必看]</title>
    <link>http://www.30o.top/post-3.html</link>
    <description><![CDATA[<p>网站更换域名可能是很多站长必须会经历的事情，但是很多新手站长根据百度的教程只要一修改域名立马出问题，这是为什么呢？这篇教程我就教大家如何做到最完美的换域名！</p>
<p>教程开始之前，我们必须要先明白换域名的基本逻辑以及为什么根据百度的教程换了就会出问题呢？</p>
<p>很多新手站长想要换域名，那就直接进入后台设置中，修改WordPress地址及站点地址，那么如果你只做了这一步，那100%是会出问题的！</p>
<p>为什么？因为你只修改了WordPress地址，那么你网站中其他地方的链接就没变啊！比如文章中的、页面中的、各种设置中的等等！</p>
<p>稍微有经验的站长，可能就会百度，在百度上很容易找到一些教程，教你在数据中输入批量替换的命令进行替换，这种方法已经是比较理想的了。但是，这样仍然无法全部替换，还是会有很多地方的链接无法替换干净。</p>
<p>这时候可能有些老站长就会用到数据库的搜索功能了，找出旧地址，进行更换。没错！这种方式确实是最细致的！但是！在做这一步之前我们必须要了解数据库的数据储存格式！所有序列化的数据是不能直接改数据库的！只要改了，那这一段数据就全部失效了！</p>
<p>修改逻辑及流程<br>上面我们简单的阐述了更换域名的大致流程和可能会遇到的问题，接下来我们先整理一下更换的逻辑和流程，然后我们学习的这其中的原理。最后我们再手把手教学。</p>
<p>此教程主要针对网站更换域名、修改网站URL，同时也适用于网站批量修改图片地址、批量修改其他URL等，只要掌握这其中的原理的逻辑就都能实现。<br>修改方法其实就是通过数据库批量修改，但是我们必须要明白的就是数据库的数据储存格式问题，也就是序列化格式修改的问题。其次就是怎样才能尽量替换干净且不出错。</p>
<p>序列化格式讲解<br>数据库是无法直接储存数组(array)和对象(object)数据的，那么目前最好的方式就是将这两种数据序列化之后存入数据库，这也是WordPress和目前多数程序的方式。序列化后的数据不仅有对象内容，还有对象的类型和字符数量！没错，就是这个字符数量问题导致了，如果我们直接修改了序列化数据里面的内容，但是字符数量如果和之前的不同，那么就会导致整个数据失效！请查看以下截图，就能明白这里的逻辑了。</p>
<p><a href="/content/uploadfile/202508/031f1756224354.webp" target="_blank" rel="noopener"><img src="/content/uploadfile/202508/031f1756224354.webp" alt=""></a></p>]]></description>
    <pubDate>Wed, 27 Aug 2025 00:04:28 +0800</pubDate>
    <dc:creator>30o漫笔</dc:creator>
    <guid>http://www.30o.top/post-3.html</guid>
</item>
<item>
    <title>pbootcms模板文章加浏览权限出现404错误</title>
    <link>http://www.30o.top/post-2.html</link>
    <description><![CDATA[<p>解决方法：<br>找到文件/core/function/helper.php<br>搜索：<br>http_response_code(404);</p>
<p>复制<br>将其改成：<br>//http_response_code(404);</p>
<p><a href="/content/uploadfile/202508/f3cc1756224019.jpg" target="_blank" rel="noopener"><img src="/content/uploadfile/202508/f3cc1756224019.jpg" alt=""></a></p>]]></description>
    <pubDate>Tue, 26 Aug 2025 23:58:58 +0800</pubDate>
    <dc:creator>30o漫笔</dc:creator>
    <guid>http://www.30o.top/post-2.html</guid>
</item>
</channel>
</rss>