Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial thinkSNS 中发说说 引号转义问题

thinkSNS 中发说说 引号转义问题

Jun 23, 2016 pm 01:51 PM
quotation marks escape

ts框架在发表说说时,对于输入的引号和反斜杠的会出现显示上的错误,如:输入   "好耶"  ,  发布后显示    \"好耶\" ,后天取到的是没有斜杠的,显示的时候就有了,单引号也是如此。
不知道是thinksns低版本存在的问题还是什么情况,在thinksns3.1中没有这种情况,代码我也对比过研究过,没发现实质性的区别,想请问是否是模板渲染的时候的问题,如果是这改如何修改呢?
求大神赐教。


回复讨论(解决方案)

输出时转义了?
这是 bug,改了就是了

后台从数据库里获取后是正常的,输出到页面渲染就不行了,应该是模板渲染的方法问题吧,我之前从没动过TS框架这方面的东西,所以就不知道怎么改,尝试过替换、反转义都多多少少会有问题,所以就有点纠结了!

问题已解决,使用stripslashes()和addslashes()解决的,在把说说写进数据库时,用addslashes()方法转义,从数据库读出是,再用stripslashes()反转就行了。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

preg_quote() function in PHP: How to escape special characters in a string to regular expression characters preg_quote() function in PHP: How to escape special characters in a string to regular expression characters Nov 04, 2023 pm 02:15 PM

The preg_quote() function in PHP: How to escape special characters in a string into regular expression characters requires specific code examples. In development, we often use regular expressions to match and process strings. However, some strings may contain some special characters, such as metacharacters in regular expressions, which have special meanings and cause regular expressions to fail to work properly. In order to solve this problem, PHP provides the preg_quote() function to escape special characters in the string

Protective measures and security practices against XSS attacks Protective measures and security practices against XSS attacks Aug 10, 2023 pm 02:39 PM

Overview of protective measures and security practices against XSS attacks Cross-site scripting attacks (XSS) are a common security vulnerability that exploits a website's inadequate validation and filtering of user input. Attackers can steal users' sensitive information, such as login credentials, personal information, etc., by inserting malicious script code into web pages. In order to protect the security of our website and our users, we need to implement some protective measures and security practices to guard against this type of attack. Input validation and filtering First, we need to validate and filter user input to ensure that the entered data meets expectations

Understand the htmlspecialchars() function in PHP for escaping HTML special characters Understand the htmlspecialchars() function in PHP for escaping HTML special characters Nov 18, 2023 pm 04:19 PM

Understanding the htmlspecialchars() function in PHP is used to escape HTML special characters. The htmlspecialchars() function in PHP is a commonly used string processing function that is used to convert HTML special characters into corresponding entities. The purpose of this is to avoid syntax errors or security holes in HTML pages, and also to ensure that the data entered by the user is displayed correctly on the page. In many cases, we need to treat user-entered data as HTML code

How to deal with the escaping problems of single quotes, double quotes and backslash errors in PHP language development? How to deal with the escaping problems of single quotes, double quotes and backslash errors in PHP language development? Jun 11, 2023 pm 05:33 PM

In PHP language development, single quotes, double quotes and backslashes are common characters, but when processing strings, they may cause escaping problems. Here's how to deal with these issues to ensure that your PHP code can handle these characters correctly. Single quotation mark problem In PHP, single quotation marks are used to represent strings, but using single quotation marks within single quotation marks will cause escaping problems. For example: $myString='I'maPHPdeveloper.'; In the above example, use backslash

Commonly used regular expression escaping techniques in PHP programming Commonly used regular expression escaping techniques in PHP programming Mar 20, 2024 am 09:00 AM

Regular expression escaping techniques commonly used in PHP programming require specific code examples. Regular expressions are a very commonly used tool in PHP programming. Through regular expressions, we can quickly match, search, and replace operations in text. However, when using regular expressions, sometimes we encounter special characters that need to be escaped, otherwise unexpected matching results will occur. In this article, we will introduce regular expression escaping techniques commonly used in PHP programming and provide specific code examples. Escape slash `` in regular expressions

Practical application of GO language string escaping and anti-escaping Practical application of GO language string escaping and anti-escaping Apr 07, 2024 pm 10:48 PM

Go language string escaping and anti-escaping allows developers to specify non-displayable characters or keep characters literal. Escape uses backslashes to convert special characters into escape sequences, while unescaping uses backticks to restore the original value of the escape sequence. Understanding these operations is crucial for working with text that contains special characters, such as escaping HTML tags into plain text without parsing them.

Deciphering the secret of less than or equal to escape characters in MyBatis Deciphering the secret of less than or equal to escape characters in MyBatis Feb 21, 2024 pm 10:06 PM

Title: Deciphering the Mystery of Less Than or Equal Escape Characters in MyBatis When using MyBatis for database operations, you often encounter situations where you need to query for a value less than or equal to a certain value. In SQL statements, the less than or equal condition usually uses "

PHP regular expression escape: detailed explanation of the role of escape characters PHP regular expression escape: detailed explanation of the role of escape characters Mar 19, 2024 pm 02:18 PM

PHP regular expression escaping: a detailed explanation of the role of escape characters In PHP, regular expressions are a powerful tool used to find and replace specific content in text. When using regular expressions, you often encounter situations where special characters need to be escaped. This article will introduce in detail the role of regular expression escaping in PHP, as well as specific code examples. The role of escape characters In regular expressions, some characters have special meanings, such as .,, `*`, etc. If we want to match these special characters themselves rather than their special containing

See all articles