请看这两个页面:http://www.qgren.com/qigong/gongfa/15_30.shtml
摘要出现乱码。
再看这个页面:http://www.qgren.com/qigong/gongfa/15_28.shtml
摘要没有乱码,很正常。
在网站,部分页面正常,部分页面摘要乱码。我有点晕。
程序是dedecms,gbk版本。我网页模板也是gbk。
调用摘要的代码如下:
{dede:field.description runphp='yes'}
if(@me'' )@me = '
摘要:'.@me.'
';{/dede:field.description}
不知道谁能解我疑惑,为什么会这样?
回复讨论(解决方案)
无余没、无余欲 後有特殊字符。
?查一下。
被加入了空格,删掉即可
观察到 meta 中是一样的乱码,所以就从 meta 中取了
$t = get_meta_tags('http://www.qgren.com/qigong/gongfa/15_30.shtml');echo '乱码:', $s = $t['description'], PHP_EOL;echo '还原:', str_replace(' ', '', $s);乱码:阿难。有犯戒。彼于心解脱、慧解脱如实知。彼于所起犯戒无余灭、无余没、无余欲? 5敝?侨耸そ?煌恕N宜当巳宋?そ?帧W苑侨缋础4硕?屑洹K?芟ぶ?J枪省0⒛选D?锪咳巳硕? H松瞥锪咳巳硕? H顺锪咳巳恕
还原:阿难。有犯戒。彼于心解脱、慧解脱如实知。彼于所起犯戒无余灭、无余没、无余欲荆当知是人胜进不退。我说彼人为胜进分。自非如来。此二有间。谁能悉知。是故。阿难。莫筹量人人而龋人善筹量人人而玻人筹量人人
虽然看到的是所谓的空格,但也可能是某个汉字的变异
所以请核对文字后告知差异
被加入了空格,删掉即可
观察到 meta 中是一样的乱码,所以就从 meta 中取了
$t = get_meta_tags('http://www.qgren.com/qigong/gongfa/15_30.shtml');echo '乱码:', $s = $t['description'], PHP_EOL;echo '还原:', str_replace(' ', '', $s);乱码:阿难。有犯戒。彼于心解脱、慧解脱如实知。彼于所起犯戒无余灭、无余没、无余欲? 5敝?侨耸そ?煌恕N宜当巳宋?そ?帧W苑侨缋础4硕?屑洹K?芟ぶ?J枪省0⒛选D?锪咳巳硕? H松瞥锪咳巳硕? H顺锪咳巳恕
还原:阿难。有犯戒。彼于心解脱、慧解脱如实知。彼于所起犯戒无余灭、无余没、无余欲荆当知是人胜进不退。我说彼人为胜进分。自非如来。此二有间。谁能悉知。是故。阿难。莫筹量人人而龋人善筹量人人而玻人筹量人人
文字差异:
还原:阿难。有犯戒。彼于心解脱、慧解脱如实知。彼于所起犯戒无余灭、无余没、无余欲荆当知是人胜进不退。我说彼人为胜进分。自非如来。此二有间。谁能悉知。是故。阿难。莫筹量人人而龋人善筹量人人而玻人筹量人人
文字:阿难。有犯戒。彼于心解脱、慧解脱如实知。彼于所起犯戒无余灭、无余没、无余欲 尽。当知是人胜进不退。我说彼人为胜进分。自非如来。此二有间。谁能悉知。是故。阿难。莫筹量人人而 取。人善筹量人人而病。人筹量人人
找到共同规律,都是一个字后接一个句号。
版主看看
无余没、无余欲 後有特殊字符。
?查一下。
无余没、无余欲 后面并没有特殊字符,见文档。后面是 尽。
无余灭、无余没、无余欲尽。当知是人胜进不退。
$t = get_meta_tags('http://www.qgren.com/qigong/gongfa/15_30.shtml');$s = $t['description'];$n = strpos($s, '欲')+2;$t = substr($s, $n);echo bin2hex('尽。当'), PHP_EOL;echo bin2hex($t), PHP_EOL;$n = strpos($s, '而')+2;$t = substr($s, $n);echo bin2hex('取。人'), PHP_EOL;echo bin2hex($t), PHP_EOL;echo str_replace(' ', "\xa1\xa1", $s), PHP_EOL;echo bin2hex(' '); //再看看全角空格
bea1a1a3b5b1be20a3b5b1d6aacac7c8cbcaa4bdf8b2bbcdcba1a3ced2cbb5b1cbc8cbceaacaa4bdf8b7d6a1a3d7d4b7c7c8e7c0b4a1a3b4cbb6fed3d0bce4a1a3cbadc4dccfa4d6aaa1a3cac7b9caa1a3b0a2c4d1a1a3c4aab3efc1bfc8cbc8cbb6f8c820a3c8cbc9c6b3efc1bfc8cbc8cbb6f8b220a3c8cbb3efc1bfc8cbc8cba1c8a1a1a3c8cbc820a3c8cbc9c6b3efc1bfc8cbc8cbb6f8b220a3c8cbb3efc1bfc8cbc8cba1阿难。有犯戒。彼于心解脱、慧解脱如实知。彼于所起犯戒无余灭、无余没、无余欲尽。当知是人胜进不退。我说彼人为胜进分。自非如来。此二有间。谁能悉知。是故。阿难。莫筹量人人而取。人善筹量人人而病。人筹量人人?a1a1
很显然,你在处理文字时做了将全角空格替换成半角空格的处理
这就是问题的根源!
$t = get_meta_tags('http://www.qgren.com/qigong/gongfa/15_30.shtml');$s = $t['description'];$n = strpos($s, '欲')+2;$t = substr($s, $n);echo bin2hex('尽。当'), PHP_EOL;echo bin2hex($t), PHP_EOL;$n = strpos($s, '而')+2;$t = substr($s, $n);echo bin2hex('取。人'), PHP_EOL;echo bin2hex($t), PHP_EOL;echo str_replace(' ', "\xa1\xa1", $s), PHP_EOL;echo bin2hex(' '); //再看看全角空格
bea1a1a3b5b1be20a3b5b1d6aacac7c8cbcaa4bdf8b2bbcdcba1a3ced2cbb5b1cbc8cbceaacaa4bdf8b7d6a1a3d7d4b7c7c8e7c0b4a1a3b4cbb6fed3d0bce4a1a3cbadc4dccfa4d6aaa1a3cac7b9caa1a3b0a2c4d1a1a3c4aab3efc1bfc8cbc8cbb6f8c820a3c8cbc9c6b3efc1bfc8cbc8cbb6f8b220a3c8cbb3efc1bfc8cbc8cba1c8a1a1a3c8cbc820a3c8cbc9c6b3efc1bfc8cbc8cbb6f8b220a3c8cbb3efc1bfc8cbc8cba1阿难。有犯戒。彼于心解脱、慧解脱如实知。彼于所起犯戒无余灭、无余没、无余欲尽。当知是人胜进不退。我说彼人为胜进分。自非如来。此二有间。谁能悉知。是故。阿难。莫筹量人人而取。人善筹量人人而病。人筹量人人?a1a1
很显然,你在处理文字时做了将全角空格替换成半角空格的处理
这就是问题的根源!
还是有点乱码,人筹量人人 ?。多了一个怪异的东东。
我把你这段代码试过了,有点纳闷,纳闷的是
echo str_replace(' ', "\xa1\xa1", $s);
这段代码后面不输出东西, ?,这个怪异的东东就不会出现。
反之,只要后面输出什么,比如你的代码,输出个PHP_EOL, ?就出现了。
真的好奇怪啊

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
