The eval function is a string escape, which is very painful. please help me.

Source: Internet
Author: User
The eval function is a string escape, which is extremely painful. Please help the following code and output a correct href: 111 <;? Php $ tb; $ wcHead $ tb. & lt; tr & gt; $ wcTable; $ wcFoot & lt; tr & gt; $ t1111111fdddd; $ wcTabl eval function, a string escape, extremely painful, thank you!
The following code is correct. you can correctly output an href. when you click it, 111 is displayed.
 
$ Tb = '';
$ WcHead = '$ tb. = \'';
$ WcTable = '';
$ WcFoot ='\';';

$ T = '11111fdddd ';
$ WcTable ='Test'; // --------- Note that
$ Wc = $ wcHead. $ wcTable. $ wcFoot;
Eval ($ wc );

Echo $ tb;
?>

However, what I want to implement is: $ t = '1111111fddddd' pops up at a click. how can I implement the value of this variable ?? The following is an error:
$ WcTable ='Test';
$ WcTable ='Test';


------ Solution --------------------
$wcTable=<<
 test
html;

------ Solution --------------------
  
$ Tb = '';
$ WcHead = '$ tb. = \'';
$ WcTable = '';
$ WcFoot ='\';';

$ T = '11111fdddd ';
$ WcTable ='Test'; // --------- Pay attention to this
$ Wc = $ wcHead. $ wcTable. $ wcFoot;
Eval ($ wc );

Echo $ tb;
?>

------ Solution --------------------
Reference:
Reference: PHP code? 123 $ wcTable = < TestHtml;
No, it's parsed.

Test

Why not? Pop up 1111111 fdddd. isn't it exactly what you want?

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.