+ 2

Html Cant run Php but how can I solve this problem?

People. I have the following problem: I'm working on a Sololearn community game with Visual Studio. As it is usual in games, you should be able to save the game state in this project. There are two solutions: Server-side and client-side. I decided to make the first version client-side. My problem is that .html files are not able to execute a php script as long as it has the extension .html. You might think that the problem is solved if you just rewrite the html script to php. Wrong thought. If you do that, you can't open the Html script in the browser anymore. The question that arises: How do I embed an external PhP script in a Html script so that I can create a file with the score of the game locally in the brwoser? Translated with www.DeepL.com/Translator (free version)

9th Apr 2023, 9:17 AM
Shiko
Shiko - avatar
2 Answers
+ 5
You cannot write PHP in html (even you can write but your file extension should be PHP) but you can write html in PHP. PHP script needs server to run on web so use any PHP server to execute your project on Web.
9th Apr 2023, 9:31 AM
AĶ¢J
AĶ¢J - avatar