Need a bit of PHP help here, the included content is appearing as ‘1’ which means that its true but need it’s contents to appear and im unsure why it isn’t. Here is a shortened version of a function:
public function content {
$website->content = 'Some content here. ';
ob_start();
include('myfile.php');
$file_content = ob_end_clean();
$website->content .= $file_content;
$website->content .= ' Some more content here.';
echo $website->content;
}
This outputs:
Some content here 1 Some more content here
When I need it to output:
Some content here 'Included file content here' Some more content here
Any idea’s how I can fix this?
Try using
ob_get_clean()instead ofob_end_clean().Both clear the current buffer but
ob_end_clean()returns a boolean, whereasob_get_clean()returns the contents of the current buffer.