Php outputs the http address in the database and the format changes. how can this problem be solved? I know that we can use str_replace to replace \ With '', but this will also cause problems, if the data in json format contains Chinese characters, the \ asd5 of Chinese characters will be changed to asd5 .. Is there any other way to solve this problem?
Reply
How does PHP write to the database according to format and read it???
HTML Code
When: postdb[sku_name][1_50]= black postdb[sku_sku][1_50]=m postdb[sku_price][1_50]=100 postdb[sku_shopid][1_50]=1000 p Ostdb[sku_storage][1_50]=mj1 postdb[sku_name][1_55]= Yellow postdb[sku_sku][1_55]=x postdb[sku_price][1_55]=77 postdb[ sku_shopid][1_55]=1000 postdb[sku_storage][1_55]=mj2postdb[sku_name][7_60]
If you put the HTML into the database, if you need to edit the article again, you can't do it.
If you store markdown,
When the article is displayed, you need to format the article, if the backend uses Markdown parsing and the Markdown Editor standard is not the same, but also prone to problems
The backend needs an extra distinction between articles published with the Rich text editor and artic
Tags: query datetime rem from Ted not accept sage tablesThere was an error when the date data in the XML Schema format was stored in the DateTime field in the database Mysql> SELECT @ @sql_mode; +--------------------------------------------+
|
@ @sql_mode | +--------------------------------------------+
|
strict_trans_tables,no_engine_substitution | +--------------------------------------------+ 1 row in Se
About this I know can use Str_replace to replace \ ", but this will also have a problem, if the JSON format of the data inside the Chinese characters, the \ASD5 will become ASD5. Is there any other way to solve this problem?
Reply to discussion (solution)
Why/Will it turn into a/, do you find the reason?/Not a special character, no PHP function escapes it (except Preg_quote)
You can use the str_replace to replace \/with '/' ....
Why/Will it
This format control and editing coordination FCKeditor is used, is perfect, fckeditor use in my other posts have a simple introduction.
When you read data from a textarea, and then read the data from the database, the simplest way to control how it appears in the JSP page as entered in textarea is to use
Adding such a statement to a CSS file can fix this problem.
pre{White-space:pre-wrap;White-space:-mo
$db =new mysqli ("localhost", "root", "123", "t_90052");$sql = "SELECT * from Info";$result = $db->query ($sql);$arr = $result->fetch_all ();foreach ($arr as $v){$sex = $v [2]? " Male ":" Female ";Eaho "}?>Displaying information about database info tables in tabular format
In many cases, the provincial/municipal (district) level-2 linkage drop-down menus, such as address information and weather API calls, are used during Website Development. They are also universal, A warehouse is used everywhere. this method has been mentioned in the previous articles in Nongfu Manor. However, the provincial and municipal information found on the Internet is poor. many cities at the county level are listed in the district city, and will be deleted later, it was quite troublesome.
When you need to develop and output HTML reports in the database, you can directly use the htp package during the process to implement HTML code and output after data processing. and the output is in the desired format (controlled by the HTML Markup Language ). the following is a test example for generating HTML reports directly from a database. You need to modif
The process is to parse the xml sent by the user, obtain the content sent by the user based on the content, determine the reply to read the database content, return as a string, reply information but it seems that there is a problem in the database operation, I cannot reply to it. Other cases #039; 1 #039; and so on. I...
The process is like this.
Parse the sent xml to get the content sent by the user
In the development process, we often save the number of milliseconds in the date and time to the database, but the corresponding time seems very inconvenient, some functions can be used to convert data in milliseconds to the date format.
1. in MySQL, there is a built-in function from_unixtime () for conversion, using the following:
Mysql> select from_unixtime (1, '% Y-% m-% d % H: % I: % S ');
+ --------
Select To_date (' 2010-10-20 13:23:44 ', ' yyyy-mm-dd hh24:mi:ss ') DateTime from dual;Display results: 2010/10/20 13:23:44 Select To_date (' 2010-10-20 13:23:44 ', ' yyyy/mm/dd hh24:mi:ss ') DateTime from dual; Display results: 2010/10/20 13:23:44 Select To_char (to_date (222, ' J '), ' JSP ') from dual; Displaying results: Hundred Twenty-two If you follow the example below, you will get an error: ORA-01849: The hour value must be between 1 and 12. (Because the HH is 12 binary, no 13 error) S
Label:When the amount of text data is relatively large, the input of a strip is basically impossible, and writing a program to relay it is also very troublesome, fortunately SQL Server provides a relatively concise method.Bulk Insert table name from ' C + + your text file. txt ' with (fieldterminator = ' What symbol to split the data ', rowterminator= ' with what symbol plus \ n End ') --\n is the meaning of a carriage return, is the carriage return front is what symbol, if unsigned direct sing
the form of an object array,//So we generate the time also to store data in the objectforeach($jarr as $key=$value){$jobj-$key=$value;}Echo' Object passed after the property: ';Print_r($jobj);//print the object after passing the propertyEcho' ;Echo' Encoded JSON string: '. Json_encode ($jobj).‘ //Print the encoded JSON stringMysqli_close($con);?>The output reads as follows:Array Array Array Array ([id] = 3 [name]+ =Objectarray Array ([ID] + 3 [name] + =) Tjks)) Encoded JSON string:{"0": {"id":
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.