supesite首页如何调用discuzX论坛的数据,或者如何使用php代码
系统是:ucenter+supesite+discuzsupesite的网站首页需要调用新版discuz论坛数据,但貌似版本没更新不能直接调用了,我尝试过一下几个办法1、...
系统是:ucenter+supesite+discuz
supesite的网站首页需要调用新版discuz论坛数据,但貌似版本没更新不能直接调用了,我尝试过一下几个办法
1、安装老版本discuz7.2,结果老板discuz数据库的字段和新版的ucenter不一样了。
2、直接在首页用php输出discuz数据库的数据。————结果php代码不被允许
3、修改block.func.php文件,结果里面把头看晕了。
求指教!supesite有没有可以直接输出php的方法?或者如何修改block.func.php这个文件 展开
supesite的网站首页需要调用新版discuz论坛数据,但貌似版本没更新不能直接调用了,我尝试过一下几个办法
1、安装老版本discuz7.2,结果老板discuz数据库的字段和新版的ucenter不一样了。
2、直接在首页用php输出discuz数据库的数据。————结果php代码不被允许
3、修改block.func.php文件,结果里面把头看晕了。
求指教!supesite有没有可以直接输出php的方法?或者如何修改block.func.php这个文件 展开
1个回答
展开全部
据littlehz的建议
把PHP代码用记事本存为backlinks.php放到根目录下。
首页的index.php合适位置加上include(’backlinks.php’);
但我不知道那里才是合适的,我想放到首页下方的友情链接区附近或版权。
// THE FOLLOWING BLOCK IS USED TO RETRIEVE AND DISPLAY LINK INFORMATION.
// PLACE THIS ENTIRE BLOCK IN THE AREA YOU WANT THE DATA TO BE DISPLAYED.
// MODIFY THE VARIABLES BELOW:
// The following variable defines whether links are opened in a new window
// (1 = Yes, 0 = No)
$OpenInNewWindow = "1";
// # DO NOT MODIFY ANYTHING ELSE BELOW THIS LINE!
// ----------------------------------------------
$BLKey = "J1BI-O7K0-0DI8";
if(strlen($_SERVER['SCRIPT_URI'])){
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_URI'].((strlen($_SERVER['QUERY_STRING']))?'?'.$_SERVER['QUERY_STRING']:'');
}
if(!strlen($_SERVER['REQUEST_URI'])){
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].((strlen($_SERVER['QUERY_STRING']))?'?'.$_SERVER['QUERY_STRING']:'');
}
$QueryString = "LinkUrl=".urlencode((($_SERVER['HTTPS']=='on')?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
$QueryString .= "&Key=" .urlencode($BLKey);
$QueryString .= "&OpenInNewWindow=" .urlencode($OpenInNewWindow);
if(intval(get_cfg_var('allow_url_fopen')) && function_exists('readfile')) {
@readfile("http://www.backlinks.com/engine.php?".$QueryString);
}
elseif(intval(get_cfg_var('allow_url_fopen')) && function_exists('file')) {
if($content = @file("http://www.backlinks.com/engine.php?".$QueryString))
print @join('', $content);
}
elseif(function_exists('curl_init')) {
$ch = curl_init ("http://www.backlinks.com/engine.php?".$QueryString);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
if(curl_error($ch))
print "Error processing request";
curl_close ($ch);
}
else {
print "It appears that your web host has disabled all functions for handling remote pages and as a result the BackLinks software will not function on your web page. Please contact your web host for more information.";
}
把PHP代码用记事本存为backlinks.php放到根目录下。
首页的index.php合适位置加上include(’backlinks.php’);
但我不知道那里才是合适的,我想放到首页下方的友情链接区附近或版权。
// THE FOLLOWING BLOCK IS USED TO RETRIEVE AND DISPLAY LINK INFORMATION.
// PLACE THIS ENTIRE BLOCK IN THE AREA YOU WANT THE DATA TO BE DISPLAYED.
// MODIFY THE VARIABLES BELOW:
// The following variable defines whether links are opened in a new window
// (1 = Yes, 0 = No)
$OpenInNewWindow = "1";
// # DO NOT MODIFY ANYTHING ELSE BELOW THIS LINE!
// ----------------------------------------------
$BLKey = "J1BI-O7K0-0DI8";
if(strlen($_SERVER['SCRIPT_URI'])){
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_URI'].((strlen($_SERVER['QUERY_STRING']))?'?'.$_SERVER['QUERY_STRING']:'');
}
if(!strlen($_SERVER['REQUEST_URI'])){
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].((strlen($_SERVER['QUERY_STRING']))?'?'.$_SERVER['QUERY_STRING']:'');
}
$QueryString = "LinkUrl=".urlencode((($_SERVER['HTTPS']=='on')?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
$QueryString .= "&Key=" .urlencode($BLKey);
$QueryString .= "&OpenInNewWindow=" .urlencode($OpenInNewWindow);
if(intval(get_cfg_var('allow_url_fopen')) && function_exists('readfile')) {
@readfile("http://www.backlinks.com/engine.php?".$QueryString);
}
elseif(intval(get_cfg_var('allow_url_fopen')) && function_exists('file')) {
if($content = @file("http://www.backlinks.com/engine.php?".$QueryString))
print @join('', $content);
}
elseif(function_exists('curl_init')) {
$ch = curl_init ("http://www.backlinks.com/engine.php?".$QueryString);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
if(curl_error($ch))
print "Error processing request";
curl_close ($ch);
}
else {
print "It appears that your web host has disabled all functions for handling remote pages and as a result the BackLinks software will not function on your web page. Please contact your web host for more information.";
}
追问
大哥我也会百度的,这篇文章早看过了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询