External link to php page for global function? [closed]
I want to create a file which contains global functions and variables that all the other pages (Html and PHP) could c开发者_高级运维all for. I'm struggling in coding on index.php
at the moment, when it comes to the copyright, I've got the php function which could show the system's year, that I don't want to put this code on the top of the page as I want to put them on a separate file/sheet and have index.php to call for it.
Also I don't want to write the same copyright line on every single page I will create. Where and how could I put this content on and have it called from another files?
not real clear on your q. but .. is http://php.net/manual/en/function.include-once.php and its ilk what you want
I'm not 100% sure what you mean, but you can include other PHP files by using either include()
or require()
, they do the same thing but require()
causes the page to die if it fails.
syntax:
<?php
include("path/to/file.php);
?>
精彩评论