0
Can you access php in HTML?
Can you put php in the script
4 ответов
+ 8
+ 1
It’s very common to include php in html pages, but you don’t use <script> tags. You use php tags. The link in the previous answer explains well how you do it.
Edit:
Oops sorry, I goofed a bit. I was working on a site earlier that uses .htaccess to treat .html extension as php so actually forgot that by default php can’t be included in html. As pps said, html is included in php, not php in html, but .htaccess can be used to treat html as php.
+ 1
No, you cannot access php in HTML pages.
You can only access HTML in PHP pages.
0
You can configure your .htaccess file to take some or all html files as php files. Then server will process everything starting with <? in these files as php even XML so you need to be very careful with it. Also to be on the safe side always add settings in your htaccess file instead of editing existing values in it.