0

Can you access php in HTML?

Can you put php in the script

23rd Feb 2019, 3:12 AM
Riley
Riley - avatar
4 ответов
23rd Feb 2019, 4:12 AM
Arushi Singhania
Arushi Singhania - avatar
+ 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.
23rd Feb 2019, 4:24 AM
Mike
Mike - avatar
+ 1
No, you cannot access php in HTML pages. You can only access HTML in PHP pages.
23rd Feb 2019, 5:33 AM
Calviղ
Calviղ - avatar
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.
23rd Feb 2019, 7:07 AM
Sahil Soma
Sahil Soma - avatar