我想提一下,我有 simplepie 在我的开发环境中工作,但是一旦我上传了网站,我就无法将提要进入我的主页。有任何想法吗?这是在本地主机上工作的代码:
function Homepage()
{
parent::Controller();
$this->base = $this->config->item('base_url');
$this->css = $this->config->item('css');
$this->images = $this->config->item('images');
$this->load->library('simplepie');
$this->simplepie->set_feed_url('http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml');
$this->simplepie->set_cache_location(APPPATH.'cache/rss');
$this->simplepie->init();
$this->simplepie->handle_content_type();
}
function index()
{
$data['rssdata'] = array(
"title" => $this->simplepie->get_title(),
"description" => $this->simplepie->get_description(),
"items" => $this->simplepie->get_items(0,5)
);
$this->load->view($data)
}
this is the code that is in the view:
<h3 class="ui-widget-header"><?= $rssdata['title']?></h3>
<div id="accordion" >
<div>
<h5><?= $rssdata['description']?></h5>
<p><?php foreach($rssdata['items'] as $item) :?>
<ul>
<li><?php anchor($item->get_link(),$item->get_title());?></li>
<li class="rssfeed"><?php echo $item->get_description();?></li>
</ul>
<p><small>Posted on <?php echo $item->get_date('j F Y g:i a');?></small></p>
<?php endforeach;?>
</div>