Test code:
$url = ' Http://www.google.com/ig/calculator?hl=en&q=1USD=?tzs ';
$str = @file_get_contents ($url);
$str = Preg_replace ("/[\s\v\t\r\n]+/", "", $str);
echo "str: $STR";
In the output, the blank character after the "1 631.32137Tanzanianshillings" front "1" is old.
Also please understand the friend pointing ah, thank you!
Reply to discussion (solution)
echo Htmlspecialchars ($STR);
The entity HTML is not a space, the effect is a space
Thank you for your reply.
Could you please add something to the preg_replace in the code above and then remove the invisible blank?
Then replace it, too.
Add a line, or the same ...
$url = ' Http://www.google.com/ig/calculator?hl=en&q=1USD=?tzs ';
$str = @file_get_contents ($url);
$str = Preg_replace ("/[\s\v\t\r\n]+/", "", $str);
$str = Preg_replace ("//", "", $str);
echo "STR: $STR
";
is also a blank HTML symbol
I know "" is a blank symbol, I do not know what to add in the above the regular point, in order to the string "1" after the blank to remove
You know, that's a little bit of a space.
PHP Page Header There is a large section of comment description, how to find out where it was written,
the contents of the comment are as follows:
* @copyright: Copyright 2006 FEIFENGXLQ * @license: Version 2.0 * @create: 2006-5-31 * @modify: 2006-6-1 * @modify: FEIFENGXLQ 2006-11-4 * Description: Ultra-strong paging class, four paging modes, default to similar baidu,google-like paging style. * 2.0 added function: Support custom style, custom style, support PHP4 and
You know, that's a little bit of a space.
Moderator Good Ah,
That blank is not a space, but do not know how to remove it?
First, put all the double quotes in single quotes and try again.
First, put all the double quotes in single quotes and try again.
Change it. Or the same, the blank will not go away.
Code:
$url = ' Http://www.google.com/ig/calculator?hl=en&q=1USD=?tzs '; $str = @file_get_contents ($url); $str = Preg_ Replace ('/'/', ' \ ', $str), $str = Preg_replace ('/[\s\v\t\r\n]+/', ' ", $str); $str = Preg_replace ('//', '", $str); echo "St R: $str ";
Output Result:
STR:{LHS: ' 1U. S.dollar ', RHS: ' 1 631.32137Tanzanianshillings ', error: ', icc:true}
In $str = @file_get_contents ($url);
$str =iconv ("GBK", "Utf-8//ignore", $str);
With this, the conversion can be replaced, because there are unrecognized characters in the acceptance process, so that a conversion can identify
Oh, that's OK!
Thank you Moderator!