For example, the obtained file path is C:/Documents and Settings/Leeo/My Documents documents/logo.gif.
Now we want to get the image name logo.gif. We know that the Backslash "/" is an escape character, so we cannot directly
String temp [] = filepath. Split ("/"); // The value of filepath is the file path above.
To split the file path.
/** In Java, // indicates a/, while in RegEx, // also indicates /,* When /// is resolved to RegEx //**/String temp
Absolute paths are all paths starting with a drive letter, such as "C:\\Program Files\\boot Camp\\1.exe", which is the absolute path of 1.exe.There are two ways to represent a relative path, ". \" and ". \ \ ",". \ \ "represents the current directory,". \ \ "compares the parent directory.The path under Windows is "\" when it is accessed from the computer, but it is wrong to write this in the design program because it involves the escape character "\". Unix, Unix-like this is doing a better job,
Source: bo-blog
1. magic_quotes_gpc = on:=> \=>"=>"
2. When "inserting a database, the characters remain and are" and ". Therefore, you do not need to read stripslashes again.Exception: magic_quotes_runtime = on.
3. If the/e modifier is used in the pattern of preg_replace, the situation in which replacement is passed to the callback function is:=>=>"=>"
4. Read from the database. When magic_quotes_runtime = off, it seems => null?
Conclusion: The problem of quotation marks and
The following is a detailed analysis of using recursive implementation in php to reference strings using backslash. For more information, see
Implementation code:
The code is as follows:
Function addslashes_deep ($ value)
{
// The most classic recursion in history, done in one row
Return is_array ($ value )? Array_map ('addslashes _ deep ', $ value): addslashes ($ value );
}
// Test data$ _ POST ['str'] = "'hanglor 'is \ a boy> '";$ _ GET
String dz = "D:workspace\tximage\a.png";You want to use the split () function to intercept the string.The code is as follows:String td[]=dz.split ("\\\\");if (td.length>1) {for (int i=0;i{System.out.println (Td[i]);}String last = td[td.length-1];System.out.println (last);}else {System.out.println ("no!");}Execution Result:D:WorkspacesTximageA.pngA.pngFocus: The regex is \\\\, because in Java \ \ represents a \, and the Regex \ \ is also represented \, so when \\\\ resolves to regex it is \ \.Usi
assuming the datacontractjsonserializer would be used for that too. Would cross the bridge when I come to it...if it creates a problem. It hasn ' t far, with my simple DTOs.UPDATE See Oleg ' s answer (the UPDATE2 part). He changes the return type of the service method from void System.ServiceModel.Channels.Message to, and rather than using HttpContext.Current.Response.Write() , he uses:return WebOperationContext.Current.CreateTextResponse (json, "application/json; charset=utf-8", Encoding.UT
The example of this article describes the solution of two times backslash escape and database class escape in thinkphp storage. Share to everyone for your reference. The specific methods are as follows:
This situation occurs when the MAGIC_QUOTES_GPC is open. The reason is that thinkphp in the storage time did not determine whether MAGIC_QUOTES_GPC open, regardless of 3,721 of the escape processing.The workaround is to add the following code to the e
$str =$_post["str"]; Read the contents of STR to the $STR variable
if (GET_MAGIC_QUOTES_GPC ()) {//if GET_MAGIC_QUOTES_GPC () is open
$str =stripslashes ($STR); To process a string
}
Copy CodeHere are three ways to
, [akm$] will match the character "a", "K", "M", or any of the "$", and "$" is usually used as a metacharacters, but in a character category, its attributes are dropped and restored to normal characters.
You can use a complement to match characters that are not in range. The practice is to put "^" as the first character of the category; "^" in other places will simply match the "^" character itself. For example, [^5] will match any character other than "5".
Perhaps the most important metachara
What does domain. comindex. phpuser123 mean? How is compatibility? Is this writing standard supported by all PHP servers and browsers? For example
domain.com/index.php/user/123
What does this statement mean?
How is compatibility? Are all PHP
For example:
Echo ' WhoAmI ';
Export the database, the folder to be imported must have writable permission, the content after-u-p must be written next to each other
Echo ' mysqldump-h localhost-u$dbuser-p$dbpwd--default-character-set=utf8
First of all, please refer to the English addslashes () function, which can achieve the function you want, you should also refer to the Php3.ini set MAGIC_QUOTES_GPC options.
The function ereg_replace () can achieve the results you want, as follows:
$.ajax
PHP Backend return:
PHP code
Reply to discussion (solution)
Turn off PHP settings Magic quotes GPCor run stripslashes on the results
Turn off PHP settings Magic quotes GPCor run stripslashes on the results
Excuse me,
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.