您的位置:68399皇家赌场 > 集群主机 > 【皇家赌场】THINKPHP JS达成缩放图片式截图的贯彻

【皇家赌场】THINKPHP JS达成缩放图片式截图的贯彻

发布时间:2019-07-28 06:52编辑:集群主机浏览(108)

    作者:杨鑫奇

    安装ucenter;

    PHP常用类库

    本来公布过一个退出数据库的分页类,方今使用的时候开掘有一些时候搜索的事物过于大的时候,选拔url传递参数的点子,恐怕会有一定的影响恐怕叫已知的bug,本次做了一些恢宏,同不时候包容了在此以前的情势,使用方面很简单的,只供给多安装四个参数就可以了代码如下:

    固有链接:

    设置discuz,自动加载到ucenter并通讯成功;

    数组类
    class libArray
    {
        /**
         * 多维数组合併
         * @return array
         */
        public static function merge ()
        {
            $args = func_get_args();
            $array = [];
            foreach ( $args as $arg ) {
                if ( is_array($arg) ) {
                    foreach ( $arg as $k => $v ) {
                        if ( is_array($v) ) {
                            $array[$k] = isset($array[$k]) ? $array[$k] : [];
                            $array[$k] = self::merge($array[$k], $v);
                        } else {
                            $array[$k] = $v;
                        }
                    }
                }
            }
            return $array;
        }

    复制代码 代码如下:

    今早TP论坛的壹个人小叔子加笔者了,说也碰到这么些方面包车型地铁主题材料,呵呵!想想其实过多事物都高出了,是否应当分享出去吗?其实本人的大队人马事物都以旁人这来的,取之于网络用之于互联网!唯有我们多享受,手艺够升高!

    再品尝把ucenter里的事例布置到ucenter通讯,叫uclogion吧,想从uclogion登陆,discuz会同步登陆,

        /**
         * 多维to一维
         * [1=>['a'=>'v1']] to ['1|a'=>'v1']
         * @param array $array
         * @param string $delimiter
         * @param string $key
         * @return array
         */
        public static function mTo1 (array $array, $delimiter = '|', $key = '')
        {
            $data = [];
            if ( !is_array($array) ) {
                return $data;
            }
            foreach ( $array as $k => $v ) {
                $keyNew = trim($key.$delimiter.$k, $delimiter);
                if ( is_array($v) ) {
                    $data = array_merge($data, self::mTo1($v, $delimiter, $keyNew));
                } else {
                    $data[$keyNew] = $v;
                }
            }
            return $data;
        }

    <?php
    /**
    * 成效: 分页类,依据提供的数额总数和页面大小
    * 创立日期:Fri Apr 20 16:45:21 CST 二〇〇五
    * 最终更新:
    * 作者: sanshi <sanshi0815@tom.com>
    */

    兑现形式

    向来把config.inc.php里的////通讯相关全体证明,把ucenter里生成的"应用的 UCenter 配置音信"加到config.inc.php前边;通信不成功,别急;参谋下

        /**
         * 数组排序
         * @param array $array
         * @param $column
         * @param bool $reverse
         * @return bool
         */
        public static function sort (array &$array, $column, $reverse = FALSE)
        {
            $arrColumn = [];
            foreach ( $array as $key => $val ) {
                $arrColumn[$key] = $val[$column];
            }
            return array_multisort($arrColumn, $reverse ? SORT_DESC : SORT_ASC, $array);
        }

    class pagination
    {
        var $result = array();
        var $pVar = "myp";//page参数分页记数
        var $urlParamStr = ""; //页面包车型地铁持有参数
        var $sqlMoveNumber = 0; //数据的偏移量
        var $is_post = false;

    上传图片 -- 保存并显示图片 -- JS获取缩略图参数 -- 提交地方参数 -- 图片缩放保存类管理图片 -- 保存截取的图纸--更新数据库 -- 跳转

    出错尽管不是在一样地方,但给自个儿帮忙一点都不小了,

        /**
         * 加多索引
         * @param array $array
         * @param $key
         * @return array
         */
        public static function index (array $array, $key)
        {
            $ret = [];
            foreach ( $array as $val ) {
                $ret[$val[$key]] = $val;
            }
            return $ret;
        }

        public function pagination()
        {

     

    末段结果;是config.inc.php加个$database = 'mysql';就通讯成功;

        /**
         * 增添内外缀
         * @param $array
         * @param null $pre
         * @param null $suf
         * @return array
         */
        public static function addFix (array $array, $pre = NULL, $suf = NULL)
        {
            $ret = [];
            foreach ( $array as $key => $val ) {
                $ret[$key] = $pre.$val.$suf;
            }
            return $ret;
        }
    }

        }
        public function set($sum,$pageSize,$page="",$is_post = false)
        {
            $this->is_post = $is_post;
            $this->pVar = defined('PAGE_BAR') ? PAGE_BAR : 'myp' ;
            $url = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
            //总结出总页数
            $curPage = $this->getCurPage();

    上几张截图

    皇家赌场 1

    数量检查类
    class libCheck
    {
        /**
         * 是否为IP(IPv4)
         * @param $ip
         * @return bool
         */
        public static function isIP ($ip)
        {
            $isIP = filter_var($ip, FILTER_VALIDATE_IP) ? TRUE : FALSE;
            return $isIP;
        }

            $temp['sumPage'] = ceil($sum/$pageSize);
            //修改了,页码高出的bug
            if($curPage>$temp['sumPage']) $curPage=$temp['sumPage'];
            $temp['curPage'] = $curPage;
            $temp['nextPage'] = $temp['sumPage'] > $curPage ? ($curPage 1) : $temp['sumPage'];
            $temp['upPage'] = $curPage >1 ? $curPage-1 :1;
            $temp['endPage'] = $temp['sumPage'];
            $this->urlParamStr = $this->_makeUrl($url);
            $temp['urlPageStr'] = ($page=="") ? $this->_makeUrl($url) : $page.$this->urlParamStr;

    皇家赌场 2

    好了;景况有了,开端大家的代码分板吧!

        /**
         * 是还是不是为邮箱地址
         * @param $mail
         * @return bool
         */
        public static function isMail ($mail)
        {
            $isMail = filter_var($mail, FILTER_VALIDATE_EMAIL) ? TRUE : FALSE;
            return $isMail;
        }

            $this->sqlMoveNumber = $curPage <2 ? 0 : ($curPage-1)*$pageSize;
            $temp['sqlMoveNumber'] = $this->sqlMoveNumber;
            $temp['rowNo'] = $sum;
            $this->result = $temp;
            return $this->result;
            //print_r($temp);exit();
        }
        public function getSqlMove()
        {
            return $this->sqlMoveNumber;
        }
        public function getFooter()
        {
            $str= "共有 <FONT COLOR=#FF0033>{$this->result['rowNo']}</FONT> 条 <a href='{$this->result['urlPageStr']}{$this->result['upPage']}'";
            if($this->is_post) $str .=" onclick='return sanshi_page_post(this.href,{$this->result['upPage']});' ";
            $str .=" >上一页</a> ";
            $str .=" 当前 {$this->result['curPage']} 页";
            $str .=" 共有 {$this->result['sumPage']} 页";
            $str .=" <a href='{$this->result['urlPageStr']}{$this->result['nextPage']}'";
            if($this->is_post) $str .=" onclick='return sanshi_page_post(this.href,{$this->result['nextPage']});' ";
            $str .=" >下一页</a>";
            return $str;
        }
        public function getJumpPage()
        {
            if($this->is_post)
            {
                $str = " 跳到第 <select name='topage' size='1' onchange='sanshi_page_post("{$this->result['urlPageStr']}" this.value,this.value)'>n";
            }else{
                $str = " 跳到第 <select name='topage' size='1' onchange='window.location="{$this->result['urlPageStr']}" this.value'>n";
            }
    for($i=1;$i<=$this->result['sumPage'];$i )
    {
    $str .= ($i==$this->result['curPage']) ? "<option value='$i' selected>$i</option>n" : "<option value='$i'>$i</option>n";
    }
    $str.="</select> 页";
             //输出form表单
            if($this->is_post)
            {
                $str .="<script type="text/javascript"><!--
                function sanshi_page_post(jump_link,page_no)
                {
                    document.getElementById('sanshi_goPage').action = jump_link; document.getElementById('{$this->pVar}').value = page_no;
                    document.getElementById('sanshi_goPage').submit();
                    return false;
                }

     

    在ucenter里的报到页面写的很精晓

        /**
         * 是否为URL
         * @param $url
         * @return bool
         */
        public static function isURL ($url)
        {
            $isMail = filter_var($url, FILTER_VALIDATE_URL) ? TRUE : FALSE;
            return $isMail;
        }

    // --></script>";
                $str .="<form name='sanshi_goPage' id='sanshi_goPage' method=post>";
                $str .="<input type="hidden" name='{$this->pVar}' id='{$this->pVar}' value=0>";
                $_POST = isset($_POST) ? $_POST : array();
                foreach($_POST AS $k=>$v)
                {
                    $str .="<input type="hidden" name="{$k}" id="{$k}" value="{$v}">";
                }
                $str .="</form>";
            }
    return $str;
        }
        public function getCurPage()
        {
            return isset($_GET[$this->pVar]) ? intval($_GET[$this->pVar]) : 1 ;
        }
        //深入分析出url的参数重临?后的参数,页码为空 包涵问号
        private function _makeUrl($url)
        {
            $arrayUrl=parse_url($url);
            if(isset($arrayUrl['query']))
            {
                $q=$arrayUrl['query'];
                parse_str($q,$qParam);
                //print_r($qParam);
                if(array_key_exists($this->pVar,$qParam))
                {
                    foreach ($qParam AS $k=>$v)
                    {
                        if($k !=$this->pVar) $temp[$k] = $v;
                    }
                    $temp[$this->pVar] = "";
                    if(function_exists("http_build_query"))
                        return '?'.http_build_query($temp);
                    else
                        return '?'.sanshi_http_build_query($temp);
                }else {
                    return "?{$q}&{$this->pVar}=";
                }
            }else{
                return "?{$this->pVar}=";
            }

    以下是实例截图

               //生成同步登入的代码
                  $ucsynlogin = uc_user_synlogin($uid);          //$uid 会员新闻的ID;

        /**
         * 是否为正整数
         * @param $num
         * @return bool
         */
        public static function isPosiInt ($num)
        {
            $isPosiInt = is_int($num) && $num > 0;
            return $isPosiInt;
        }

        }
    }
    function sanshi_http_build_query($a,$b='',$c=0)
    {
        if (!is_array($a)) return false;
        foreach ((array)$a as $k=>$v)
        {
            if ($c)
                $k=$b."[".$k."]";
            elseif (is_int($k))
                $k=$b.$k;
            if (is_array($v)||is_object($v))
            {
                $r[]=http_build_query($v,$k,1);
                continue;
            }
            $r[]=$k."=".urlencode($v);
        }
        return implode("&",$r);
    }
    /*
    //print_r($_SERVER);
    $p = new pagination();
    $p->set(10,2,'thi.php');
    echo $p->getFooter();
    皇家赌场,echo $p->getJumpPage();
    */
    ?>

    本文由68399皇家赌场发布于集群主机,转载请注明出处:【皇家赌场】THINKPHP JS达成缩放图片式截图的贯彻

    关键词: 68399皇家赌场 Discuz

上一篇:12个MySQL工具得以简化开拓进度

下一篇:没有了