我的笨工作不能重新声明SITE_URL,我想取就我的网页致命错误:()
网站主页的博客文章当我包括两个文件
require_once('blog/wp-blog-header.php');
require_once('blog/wp-includes/link-template.php');
我得到了一个错误。
function site_url($path = '', $scheme = null) {
return get_site_url(null, $path, $scheme);
}
这个错误被删除,网站wotks的所有功能,但是当我打开 博客是不开放它给错误
:
Fatal error: Cannot redeclare site_url() (previously declared in /home/homebidpro/public_html/dev/system/helpers/url_helper.php:83) in /home/homebidpro/public_html/dev/blog/wp-includes/link-template.php on line 3004
我根据位置文件中所注释此功能dev.homebidpro.com页面无法正常工作
博客和项目位置i同样都在开发文件夹。
我坚持到现在。请尽快提供解决方案。
的代码的其余部分是
public function blogData()
{
require_once('blog/wp-blog-header.php');
require_once('blog/wp-includes/link-template.php');
if($catagory !='')
{
$args = array( 'posts_per_page' => 3, 'category_name' => $catagory);
}
else
{
$args = array('posts_per_page' => 4);
}
$mypostsMov = get_posts($args);
// echo "<pre>"; print_r($mypostsMov); die;
$mypostsarrayMov = array();
$i=0;
foreach ($mypostsMov as $post) :
$excerpt = preg_replace("/<img[^>]+\>/i", "", $post->post_content);
$mypostsarrayMov[$i]['post_title'] = strip_tags($post->post_title);
$mypostsarrayMov[$i]['content'] = strip_tags($post->post_content);
$mypostsarrayMov[$i]['permalink'] = get_permalink($post->ID);
$mypostsarrayMov[$i]['thumbnail'] =get_the_post_thumbnail($post->ID,array(300, 200));
$i++;
endforeach;
wp_reset_postdata();
//echo "<pre>"; print_r($mypostsarrayMov); die;
//return $this->render('MovePlusServiceBundle:Default:recentpostCombined.html.twig',array('mypostsMov'=>$mypostsarrayMov,));
return $mypostsarrayMov;
}
而且site_url
功能,该功能在codeigniter
if (! function_exists('site_url'))
{
function site_url($uri = '')
{
$CI =& get_instance();
return $CI->config->site_url($uri);
}
}
和SITEURL函数,它是博客的文件夹,我已经给你。
您尝试重写一个组合的形式存在功能'SITE_URL()'你需要重命名功能或用户存在'SITE_URL()'或'get_site_url直接将网站的网址(null,$ path,$ cheme)'last是连击方式,因为为php调用函数这个功能太难了,太复杂了(difficalty我不知道如何改正写)你的应用程序。 – Naumov
您只能定义一次函数'site_url()'。这个错误意味着它已经被宣布了一些其他的东西。 – Peter
@peter:当我在site_url()函数中注释一个site_url()时,在这种情况下做什么,然后某些功能不起作用 –