简体   繁体   中英

How can i add a .php link in my html file

Basically i have a php script that i use to log requests on my website.(ip/browser, etc) which is log.php, how can i include the log.php in my index.html so every time someone visits my website they also get "logged"? I have tried a couple of things and its way off than what i want to do. Basically i want to include domain.com/log.php on my main page..

I tried so many things so far and nothing has worked, i think its really really simple but i can't make it work. Any help is highly appreciated.

Sorry for my bad english, not my first language. I hope you can understand what i mean.

The include statement takes all the text/code/markup that exists in the specified file and copies it into the file that uses the include statement.

Here's an example:

<HTML>
<head></head>
<body>

<h1>Welcome to this page!</h1>
<p>Some text.</p>
<?php include ('footer.php'); ?>

</body>
</html>

You can really execute a php code in a html file, what you can do is create a php file called index.php from there create add your code 'logging' code and then render the content of your page.

example index.php

<?php

 // your code for logging the request 

  echo <html>...</html>

?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM