I have some coding which has both PHP & HTML tags... it is a very big coding... now i want to add these coding inside PHP tag... i tried using "echo" statement and adding quotes, concatenation... it doesnt work and showing some error
here is a sample line..
<td>Developer</td><td>:</td><td><?php echo wpws_get_content($url,'.doc-header-link','','user_agent=FairAndroid.com&on_error=error_hide&cache=43289&callback=call')?></td>
the above line has lots of quotes, html and php... i have lots of lines like this...
what is the best way to include (HTML开发者_开发百科 & PHP) inside PHP ??
there's nothing wrong with your line. Follow error you're seeing and try to correct them
http://sandbox.phpcode.eu/g/3a329.php
"adding quotes, concatenation" That's what you need, but it's kind of error-prone to reformat long lines:
echo '<td>Developer</td><td>:</td><td>'
. wpws_get_content($url,'.doc-header-link','','user_agent=FairAndroid.com&on_error=error_hide&cache=43289&callback=call')
. '</td>';
This is just a suggestion so that no matter how long your html codes just a simple include will simply insert it to your php file.
- Put you html codes in a different file
- Then just include it in your php file.
file.html
<p>Hello World!</p>
file.php
<?php
include("file.html");
?>
Assuming you want to print that chunk of code, you failed to escape the quotes and the special characters ( <, >, & and so on).
Splitted on multiple lines for better clarity.
<?php
echo('<td>Developer</td>');
echo('<td>:</td>');
echo('<td><?php echo wpws_get_content($url, \'.doc-header-link\', \'\', \'user_agent=FairAndroid.com&on_error=error_hide&cache=43289&callback=call\')?></td>');
?>
精彩评论