I have created some comment box kind of thing in x.php
. Looks like comment section here:
Now I want to include it as a block in my other page index.php which has already some content
So should I copy and paste the code for that content or is there any other way so that I can directly include the content at some position in my index.php?
You can re-use code using include operator. Read about it on official PHP documentation site: http://php.net/manual/en/function.include.php
To include it into another webpage, use the php include function:
<?php include("filelocation/x.php"); ?>
x.php will then be placed on the webpage where the code above was placed.
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.