I have a folder with two files
import_books_cron.php
book_importer.php
The first one looks like
<?php
echo 'Started';
include 'book_importer.php';
echo 'I will do sth';
import_books();
echo 'End';
?>
book importer looks like:
// This is some Wordpress stuff
if( !class_exists( 'WP_Http' ) )
include_once( ABSPATH . WPINC. '/class-http.php' );
include ( 'functions.php' );
function import_books() {
STUFF HERE
}
However, the only thing that I see on my terminal is 'Started'. The include statement does not seem to be working.
I have just basic knowledge of PHP. Any help?
在包含之前删除echo语句
Try this to make sure the file is actually getting loaded. if it is not, make sure it exists and is in the current folder since you are not using a path.
if(!@include("book_importer.php"))
{
echo "Not Loaded";
} else {
echo "Loaded";
}
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.