thinkSNS 中发说说 引号转义问题
ts框架在发表说说时,对于输入的引号和反斜杠的会出现显示上的错误,如:输入 "好耶" , 发布后显示 \"好耶\" ,后天取到的是没有斜杠的,显示的时候就有了,单引号也是如此。
不知道是thinksns低版本存在的问题还是什么情况,在thinksns3.1中没有这种情况,代码我也对比过研究过,没发现实质性的区别,想请问是否是模板渲染的时候的问题,如果是这改如何修改呢?
求大神赐教。
回复讨论(解决方案)
输出时转义了?
这是 bug,改了就是了
后台从数据库里获取后是正常的,输出到页面渲染就不行了,应该是模板渲染的方法问题吧,我之前从没动过TS框架这方面的东西,所以就不知道怎么改,尝试过替换、反转义都多多少少会有问题,所以就有点纠结了!
问题已解决,使用stripslashes()和addslashes()解决的,在把说说写进数据库时,用addslashes()方法转义,从数据库读出是,再用stripslashes()反转就行了。

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

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

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

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

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

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

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.

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 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
