1

我想获取字符串值,然后再使用urldecode().

Javascript

document.write(unescape('%46%43%20%42%72%61%73%6f%76%20%76%73%2e%20%43%53%4d%53%20%49%61%73%69'));

PHP

$string = "document.write(unescape('%46%43%20%42%72%61%73%6f%76%20%76%73%2e%20%43%53%4d%53%20%49%61%73%69'));";

preg_match('/document.write(unescape(\'.*\'));/', $string,$matches);
var_dump($matches);

但是这个回报array(0) { }

4

1 回答 1

0

你可以试试

$string = "document.write(unescape('%46%43%20%42%72%61%73%6f%76%20%76%73%2e%20%43%53%4d%53%20%49%61%73%69'));";
preg_match('/document.write\(unescape\(\'(.*)\'\)\);/', $string,$matches);
var_dump($matches[1]);

输出

string '%46%43%20%42%72%61%73%6f%76%20%76%73%2e%20%43%53%4d%53%20%49%61%73%69' (length=69)
于 2012-10-08T16:51:56.357 回答