PHP http链接中的变量

I'm trying to get the cureent url and send that through in a link and I'm stuck. The link displays but it's missing the url that I want to include (content in the code sample here)

'href' => ( "http://chart.apis.google.com/chart?cht=qr&chs=300x300&choe=UTF-8&chld=H&chl='.$content .'")

Your quotes aren't correct:

'href' => ( "http://chart.apis.google.com/chart?cht=qr&chs=300x300&choe=UTF-8&chld=H&chl=".$content)

You should also use urlencode() and urldecode() to ensure the $content variable is properly formatted

Edit Try this then:

$currentUrl = rawurlencode($_SERVER['PATH_INFO']);
$newUrl = "http://chart.apis.google.com/chart?cht=qr&chs=300x300&choe=UTF-8&chld=H&chl=";

header("Location: $newUrl.$currentUrl");

//Not sure if path_info will always contain the full url but there are lots of functions on the web to grab the current url that you can google for.

You're mixing single and double quotes. Try this:

'href' => ( "http://chart.apis.google.com/chart?cht=qr&chs=300x300&choe=UTF-8&chld=H&chl=".rawurlencode($content))

First: use urlencode:

$content = urlencode($content);

Second: replace your single quote with double quote.