php 添加内链插件,ecshop自动内链插件seo优化插件
ecshop自動內鏈插件seo優化插件安裝教程:
1.打開admin\includes里面的inc_menu.php文件:
添加:
$modules['11_system']['auto_neilian']???????????? = 'auto_neilian.php?act=list_edit'; // ecshop自動內鏈插件
如圖:
2.languages\zh_cn\admin\common.php 增加語言項
/* 系統設置 */
$_LANG['01_shop_config'] = '商店設置';
$_LANG['auto_neilian'] = '自動添加內鏈設置';
3? 修改跟目錄article.php
搜索:? ./* 獲得文章的信息 *
找到:$row['author'] = $GLOBALS['_CFG']['shop_name'];
在:??????? {
$row['author'] = $GLOBALS['_CFG']['shop_name'];
}
下方增加:
//seo內鏈插件 start
function str_replace_once($needle, $replace, $haystack) {
//函數作用,只替換一次字符
//$needle --- 需要替換的字符
//$replace --- 替換成什么字符
//$haystack --- 需要操作的字符串
$pos = strpos($haystack, $needle);
if ($pos === false) {
return $haystack;
}
return substr_replace($haystack, $replace, $pos, strlen($needle));
}
$content = file_get_contents("data/auto_neilian.php");
$array?? = explode("\r\n",$content);
foreach ($array AS $value){
$tmp =? explode("---",$value);
if ($tmp !== false){
if($tmp[1]){
$str = "".$tmp[0]."";
}
else{
$str = "".$tmp[0]."";
}
$str_1 = $tmp[0];
$str_2 = $str;
$tmp1 = explode("
foreach ($tmp1 as $key=>$item){
$tmp2 = explode(">",$item);
if (sizeof($tmp2)>1) {
if(substr($tmp2[0],0,1)!="a" && substr($tmp2[0],0,1)!="A"){
if(strpos($tmp2[1],$str_1)!==false){
$tmp2[1] = str_replace_once($str_1,$str_2,$tmp2[1]);
$tmp1[$key] = implode(">",$tmp2);
break;
}
}
}
}
$row['content'] = implode("
}
}
//seo內鏈插件 end
4.? 修改跟目錄goods.php
/* 如果沒有找到任何記錄則跳回到首頁 */
ecs_header("Location: ./\n");
exit;
}
else
{
下方增加:
//seo內鏈插件 start
//$content = iconv("GB2312","UTF-8",file_get_contents("data/auto_neilian.php"));
function str_replace_once($needle, $replace, $haystack) {
//函數作用,只替換一次字符
//$needle --- 需要替換的字符
//$replace --- 替換成什么字符
//$haystack --- 需要操作的字符串
$pos = strpos($haystack, $needle);
if ($pos === false) {
return $haystack;
}
return substr_replace($haystack, $replace, $pos, strlen($needle));
}
$content = file_get_contents("data/auto_neilian.php");
$array?? = explode("\r\n",$content);
foreach ($array AS $value){
$tmp =? explode("---",$value);
if ($tmp !== false){
if($tmp[1]){
$str = "".$tmp[0]."";
}
else{
$str = "".$tmp[0]."";
}
$str_1 = $tmp[0];
$str_2 = $str;
$tmp1 = explode("
foreach ($tmp1 as $key=>$item){
$tmp2 = explode(">",$item);
if (sizeof($tmp2)>1) {
if(substr($tmp2[0],0,1)!="a" && substr($tmp2[0],0,1)!="A"){
if(strpos($tmp2[1],$str_1)!==false){
$tmp2[1] = str_replace_once($str_1,$str_2,$tmp2[1]);
$tmp1[$key] = implode(">",$tmp2);
break;
}
}
}
}
$goods['goods_desc'] = implode("
}
}
//seo內鏈插件 end
5. 剩下全部覆蓋就可以了 !
總結
以上是生活随笔為你收集整理的php 添加内链插件,ecshop自动内链插件seo优化插件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php实现工厂模式,PHP基于工厂模式实
- 下一篇: php @socket_write,Fl