最新发布 第12页
if(window!=top){top.location.href=_window.location.href;} var shouji = navigator.userAgent.match(/Android|iPad|iPhone|iPod/i) != null; var url = _window.location.href; var host = _window.location.host; if(shouji){ if(url.indexOf('//www.') > -1){ var wwwurl = url.replace("//www.","//m."); location.href= wwwurl; } }else{ if(url.indexOf('//m.') > -1){ var wwwurl = url.replace("//m.","//www."); location.href= wwwurl; } }
preg_replace('~<img(.*?)>~s','',$content);
<?php error_reporting(0); header(“content-Type: text/html; charset=utf-8”); $con = mysql_connect(‘127.0.0.1:3306′,’root’,’password’);if (!$con) {die(‘Could not connect: ‘ . mysql_error()); } mysql_select_db(“sql_name”, $con); mysql_query(‘set names utf8’);echo “资讯<HR>”; $result = mysql_query(“SELECT * FROM thinkoao_article”);while($row = mysql_fetch_array($result)) {// echo ‘<a href=”https://www.xxx.com/home/article/zixun_news/id/’.$row[‘id’].’.html” target=”_blank”>’.$row[‘title’].'</a><BR>’;echo ‘https://www.xxx.com/home/article/zixun_news/id/’.$row[‘id’].’.html<BR>’;}echo “课程<HR>”; $result = “”; $result = mysql_query(“SELECT * FROM thinkoao_course”);while($row = mysql_fetch_array($result)) {//echo ‘<a href=”http://www.xxx.com/home/course/course/id/’.$row[‘id’].’.html” target=”_blank”>’.$row[‘course_name’].'</a><BR>’;echo ‘http://www.xxx.com/home/course/course/id/’.$row[‘id’].’.html<BR>’;} mysql_close($con);?>
UPDATE YourDBName_posts SET post_content = REPLACE( post_content, 'YourOldUrl', 'YourNewUrl' )
<?php $str=stripcslashes($navinfor['newstext']); //脱敏正文newstext数据preg_match_all('/<img.*?src="(.*?)".*?>/is',$str,$imgArr); //正则提取正文图片 $imgArr = array_unique($imgArr[1]); //图片如有复生将去重复 $imgid = 0; //给定初始序号 foreach($imgArr as $vause){ //判断有多少张图 $imgid ++; //循环输出每一张图 ?><div lang="[!--class.name--][!--newstime--][!--title--]" draggable="[!--class.name--][!--newstime--][!--title--]" ><img src="<?=$vause?>" alt="<?=$navinfor['title']?>第<?=$imgid?>张图片"></div><ins lang="[!--class.name--][!--newstime--][!--title--]"></ins><?php }; ?> 调用纯文字内容代码: <?php $str="sadfasfsdf<img src='dd'>asfsd"; $smalltext=preg_replace("/<img.*?>/si","",$navinfor[newstext]);echo $smalltext; ?>
windows 2008 可以用 以下的链接安装 http://www.Microsoft.com/downloads/details.aspx?FamilyID=0A391ABD-25C1-4FC0-919F-B21F31AB88B7&displayLang=zh-cn下载dotNetFx40_Full_x86_x64.exe 安装包后左键双击打开安装系统开始安装
比较实用,可以调用数据库里的所有图片字段内容 <?php require('../e/class/connect.php'); //引入数据库配置文件和公共函数文件 require('../e/class/db_sql.php'); //引入数据库操作文件 require('../e/data/dbcache/class.php'); //引入栏目缓存文件 $link=db_connect(); //连接MYSQL $empire=new mysqlquery(); //声明数据库操作类 $editor=1; //声明目录层次 $sql=$empire->query("select * from {$dbtbpre}ecms_shop order by newstime limit 1000"); //查询新闻表最新10条记录 $totalquery="select count(*) as total from {$dbtbpre}ecms_shop"; $num=$empire->gettotal($totalquery); $i=1; ?> <?=$num?><br /> <?php while($r=$empire->fetch($sql)) //循环获取查询记录 { ?> <?=$r[titlepic]?>-----[id]<?=$r[id]?>---[classid]<?=$r[classid]?>---<?=$i++?><br/> <?php } ?> <?php db_close(); //关闭MYSQL链接 $empire=null; //注消操作类变量 ?>
location / { if (!-e $request_filename){ rewrite ^(.*)$ /404.php; } }
做站的站长很多时候买个模板就直接用,对于模板的一些小优化这类知道的很少,下面来说说如何在模板中使用随机字符来提供模板的唯一性和原创程序。 方法1: 第一种方法是最容易理解的方法。它可以实现如下: 将所有可能的字母存储到字符串中,生成从0到字符串长度-1的随机索引,打印该索引处的字母,执行此步骤n次(其中n是所需字符串的长度)。 程序代码如下: <?php $n=10;function getName($n) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $randomString = ''; for ($i = 0; $i < $n; $i++) { $index = rand(0, strlen($characters) - 1); $randomString .= $characters[$index]; } return $randomString; } echo getName($n);?> 说明这里面最开始的10是字符的长度,可以随意修改。 方法2: 使用uniqid()函数。PHP中的uniqid()函数是一个内置函数,用于根据当前时间(微秒)生成唯一ID。默认情况下,它返回一个13个字符长的唯一字符串。 一次生成13个不一样的字符,减少重复。根据时间来的。 程序: <?php $result = uniqid(); echo $result; ?> 一般模板中直接插入这两段代码就可以直接用了,非常的简便 。 以上就是在帝国cms模板中插入随机字符的方法和代码实例了。
判断代码如下 <?php if($navinfor[xb]==帅哥) { ?><DIV class="xbox nan"> <? } else { echo "<DIV class=xbox>"; } ?> <?php if($navinfor['titlepic']) { ?> <a href='[!--titlepic--]' target='_blank'><img src='[!--titlepic--]' /></a> <? } else { ?> <? } ?> 亲测有效!!