现在的位置: 首页 > 综合 > 正文

测试代码记录(我自己看得,未整理)

2013年11月21日 ⁄ 综合 ⁄ 共 1223字 ⁄ 字号 评论关闭

<?php
  //require_once 'xiaohua_config.php';
  //phpinfo();
 
//  $time_str = 'Tue Jan 15 16:21:03 +0800 2013';
//  echo date('Y-m-d h:i:s',strtotime($time_str));
//  exit;

  //$str = '每日笑话大全(转)[转]「转」 @么吗吗 投稿';
  $str = '我现在发型丑脸色差长痘痘又腿粗 每天疯疯癫癫爆粗口一直在吃吃吃吃如果这个时候有人爱我那一定是真爱!毒药女流氓 投稿';
  $new_str = contentreplace($str);
  echo $new_str;
 
  function contentreplace($str){
   $str = str_replace(array('(转)','[转]','「转」'),'', $str);
   //return $str;
   //去掉@以及后面的内容
   $pos = strrpos($str,'@');
   $str = ($pos===false) ? $str : substr($str,0,$pos);
   return $str;
 }
?>

 

//首页笑话
(function(){
    var result = function(data){
        $("#day_joke").text("笑话:"+data["title"]).attr("href","/html/fun/index.htm?jid="+data["jid"]);
        $.cookie('today_joke',$("#day_joke").text(),{
            path:'/',
            expires:1
        });
        $.cookie('today_joke_url',$("#day_joke").attr("href"),{
            path: '/',
            expires:1
        });
    };
   
    if($.cookie('today_joke')==null){
        $.get("/tool/joke.php?act=getone",{},result,'json');
    }else{
        //读取cookie显示
        $("#day_joke").attr("href",$.cookie('today_joke_url'));
        $("#day_joke").html( $.cookie('today_joke'));
    } 
   
    $('#anotherJoke').click(function(){
        $.get("/tool/joke.php?act=getAnotherOne",{},result,'json');
    });
 
})();

抱歉!评论已关闭.