简体   繁体   English

如何在我的 html 文件中添加 a.php 链接

[英]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"? 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也得到“记录”? 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..基本上我想在我的主页上包含 domain.com/log.php ..

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. include 语句获取指定文件中存在的所有文本/代码/标记,并将其复制到使用 include 语句的文件中。

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. 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示例index.php

<?php

 // your code for logging the request 

  echo <html>...</html>

?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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