在通常的PHP页面中,我应该使用此:
<?php echo file_get_contents("https://www.mywebsite.com/folder/index.php?controller=pjFrontEnd&action=pjActionPrint&booking_id=" . $_GET['booking_id']); ?>
但是我不知道如何在octobercms上插入它。有什么建议吗?谢谢!
您需要使用页面的code
部分。
function onStart() {
$this['remote_content'] = file_get_contents('https://jsonplaceholder.typicode.com/todos/1');
// you can use: https://www.avminho.com/expressos/index.php?controller=pjFrontEnd&action=pjActionPrint&booking_id=" . $_GET['booking_id']
}
使用
onStart
生命周期挂钩,并将您的php代码添加到code section
中,并将输出存储到remote_content
变量中,然后像markup section
一样在{{remote_content}}
中使用它。
[注意:它将减慢您的页面加载时间,因为它将尝试从其他站点获取详细信息,从而使您的其他站点能够快速响应。
[如有疑问请发表评论。