I have an include
include ('myfile.php');
Now, I am using wordpress and to get the template path I use:
<?php echo get_template_directory_uri(); ?>
My question is:
How can I use both together?
Like:
开发者_StackOverflow<?php
include('<?php echo get_template_directory_uri(); ?>/myfile.php');
?>
Thanks
include(get_template_directory_uri() . "/myfile.php");
The include()
function just takes a string parameter. Nothing special about it.
You can use the result of the function in the include, but not by echo:ing it. Just use it directly.
<?php
include(get_template_directory_uri() . '/myfile.php');
精彩评论