html <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><body><table border="1"> <tr> <td> <?php echo$a; #百度说这样可以,但我总是失败 ?> </td> </tr></table></body></html> php <?php省略数据库查询; $a = 123;?>
There is another situation
html <!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Title</title></head><body> <form> <input type="text"> <input type="submit"> #代码简写了 </form> </body></html> php <?php 省略数据库查询; $a = 123;?>
I don’t know PHP, but I suddenly need to use it.
How to display the returned value in html after php queries the database.
After searching Baidu for a long time, I found that it didn’t work. .
We have reached the point where the ajax method is feasible. But if it is written in <script>, you can see it by directly viewing the code in the browser. How can I hide similar scripts and also achieve html php interaction?
What methods are you using now to implement html php interaction?
Thank you
Write a tpl file with a suffix name, then this tpl file is equivalent to an html file with a suffix name. Use PHP's object-oriented method to parse through regular expressions, and use PHP's caching mechanism to implement code that can be implemented without refreshing the browser. Data updates.
When writing php code in an html file, you need to change the file suffix to php, or add the html format to parsing in Apache, otherwise it will not be parsed.
# Just embed the php code in the html
It’s been a long time since I wrote this kind of mixed HTML and PHP.
Nowadays, the front-end and back-end are generally separated. The data queried by PHP is written out of the interface and returned in json form, and the front-end uses Ajax calls to obtain the data.