I don't seem to be able to use it like this. do you say the fourth line $ name is undefined or something? & amp; lt ;? Php $ name & #039; A & amp; BC & #039; $ nameurlencode ($ name); echo & #039; www. cndn. ccX1.php? Name $ name & #039 ;;? & Amp; gt; I can't seem to be able to use it like this. The fourth line of $ name is undefined or something.
$ Name = 'a & B C'
$ Name = urlencode ($ name );
Echo 'http: // www. cndn. cc/X1.php? Name = $ name ';
?>
Reply content:
I can't seem to be able to use it like this. say the fourth line $ name is undefined or something.
$ Name = 'a & B C'
$ Name = urlencode ($ name );
Echo 'http: // www. cndn. cc/X1.php? Name = $ name ';
?>
1. $ name = 'a & B c' // use A semicolon instead.
2. output variables in the string. double quotation marks are required.
The following code is correct:
$name='A&B C ';$name=urlencode($name);echo "http://www.cndn.cc/X1.php?name=$name";
Dude, you missed the semicolon in the second line.
Furthermore, if you want to output the value of $ name in the last line, you cannot use single quotation marks. you must use double quotation marks.
Pay more attention to the syntax when writing code later. such low-level errors should not be made.
$ Name = 'a & B C'; $ name = urlencode ($ name); echo "http://www.cndn.cc/X1.php? Name = {$ name} "; echo" http://www.cndn.cc/X1.php? Name = $ name "; // The echo 'http: // www. cndn. cc/X1.php? Name = '. $ name;
// The solution is the semicolon and double quotation marks mentioned above.