用ckeditor发布文章,图片路径中多了"/"咋回事啊高手指教
用ckeditor发布文章,图片路径中多了"/",怎么回事啊,高手指教!
这是一个很奇怪的现象:我用ckeditor发布新闻,里面添加了图片,在网站中我需要提取出图片路径,并在首页显示。我用的方法是在提交过程中截流,用正则表达式提取图片路径。我的正则表达式如下:
"/
我在本地的环境:win7下 apache+mysql+php;(wamp集成环境)。
上传上去的环境:win2003下 iis+mysql+php;
问题所在就是:在本地提取图片路径时没有任何问题,但是把网站上传上去后提取就不行了!!为了找到原因,我细细排查了各种问题:
1、发布文章时,在ckeditor编辑框中以源码方式查看,结果是:
“
请在这里添加文章内容!
提交文章时,在网页中输出提交内容(echo $_POST['content'];),查看源码,输出的结果是:
请在这里添加文章内容!
\"width: 400px; height: 300px;\" />
比较发现比提交前在"前多了\。
2、在浏览器中查看刚才添加的文章,图片却能正确显示,查看数据库中存储,结果是:
“
请在这里添加文章内容!
结果又和起初ckeditor编辑框中内容相同。
上面两点分析就让我搞不明白了,从开始内容正确,到提交多了“/”,到写入数据库又恢复正常,这到底是什么情况啊????
还有强调一点,网站在我本地时以上两个分析输出内容都没有任何变化,全是正确的!!
望高手指教!小弟初来论坛,分不多,以后赚到分了一定奉送!
------解决方案--------------------
这是因为使用了字符串转义的机制
例如 : "\"",双引号字符(")就可以在""双引号的范围中使用
一般使用转义的话,就是害怕你在使用这个内容的话,有和其他的双引号作处理,一般多反生在数据库sql拼接中,例如
- PHP code
$a = '我有一个双引号"';$sql = 'SELECT * FROM test WHERE title link "%'.$a.'%"'; // 仅仅是做演示,大部分都是用'<div class="clear"> </div>

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics



Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

With the widespread use of web applications, creating rich text editors has become more and more common. CKEditor is widely recognized as one of the best rich text editors because of its good customizability and ease of use. This article will introduce how to create a rich text editor using PHP and CKEditor. Introduction to CKEditor CKEditor is an open source, cross-platform rich text editor implemented through JavaScript. It provides an intuitive and easy-to-understand toolbar, including font style, formatting, graphics, etc.

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

Part 1: Initial Troubleshooting Steps Checking Apple’s System Status: Before delving into complex solutions, let’s start with the basics. The problem may not lie with your device; Apple's servers may be down. Visit Apple's System Status page to see if the AppStore is working properly. If there's a problem, all you can do is wait for Apple to fix it. Check your internet connection: Make sure you have a stable internet connection as the "Unable to connect to AppStore" issue can sometimes be attributed to a poor connection. Try switching between Wi-Fi and mobile data or resetting network settings (General > Reset > Reset Network Settings > Settings). Update your iOS version:

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Watch4pro and gt each have different features and applicable scenarios. If you focus on comprehensive functions, high performance and stylish appearance, and are willing to bear a higher price, then Watch 4 Pro may be more suitable. If you don’t have high functional requirements and pay more attention to battery life and reasonable price, then the GT series may be more suitable. The final choice should be decided based on personal needs, budget and preferences. It is recommended to carefully consider your own needs before purchasing and refer to the reviews and comparisons of various products to make a more informed choice.

How to Optimize iPad Battery Life with iPadOS 17.4 Extending battery life is key to the mobile device experience, and the iPad is a good example. If you feel like your iPad's battery is draining too quickly, don't worry, there are a number of tricks and tweaks in iPadOS 17.4 that can significantly extend the run time of your device. The goal of this in-depth guide is not just to provide information, but to change the way you use your iPad, enhance your overall battery management, and ensure you can rely on your device for longer without having to charge it. By adopting the practices outlined here, you take a step toward more efficient and mindful use of technology that is tailored to your individual needs and usage patterns. Identify major energy consumers

Everyone is looking forward to today's Windows 1123H2 release. In fact, Microsoft has just launched updates to the release preview, which is the closest channel before the official release stage. Known as Build 22631, Microsoft said they are rolling out the new rebranded chat app, phone link, and play together widgets that have been tested on other internal channels over the past few months. "This new update will have the same servicing branch and codebase as Windows 11 version 22H2 and will be cumulative with all newly announced features, including Copilot in Windows (preview)," Microsoft promises. Redmond officials further
