丁香六月欧美伊人-91免费在线观看免费-久久中文字幕人妻熟女系列-国产欧美日韩一区二区国内-日韩欧美亚洲中文字幕第二页-日韩欧美在线高清视频-亚洲欧美日韩精品综久久久久久-欧美一区二区高清视频在线观看-91亚洲精品久久久,99热在线观看亚洲区,久久a精品视频,美日韩av在线播放

php壓縮css和js

時間:2014-06-23 來源:天津文率科技有限公司

首先你要知道php 《JSMin》 這個類,壓縮js很方便

css直接去回車就行了

file_put_contents(存放路徑,str_replace(array("\r\n", "\r", "\n"), "", file_get_contents(要壓縮的css文件路徑)));

$Jsmin      =   new \Common\Extend\Jsmin();

file_put_contents(存放路徑, $Jsmin->minify(file_get_contents(要壓縮的js路徑)) );

如有不明白的可以看我的博客,里面有一些php、js、css基礎(chǔ)的教程

韓文博的新浪博客:http://blog.sina.com.cn/u/1783136603

更多網(wǎng)站建設(shè)方面的教程可以看經(jīng)常來看我們的官網(wǎng),頻繁更新中,天津網(wǎng)站建設(shè) www.srczuche.com
下面是JSMin類

<?php

/**
 * jsmin.php - PHP implementation of Douglas Crockford's JSMin.
 *
 * This is pretty much a direct port of jsmin.c to PHP with just a few
 * PHP-specific performance tweaks. Also, whereas jsmin.c reads from stdin and
 * outputs to stdout, this library accepts a string as input and returns another
 * string as output.
 *
 * PHP 5 or higher is required.
 *
 * Permission is hereby granted to use this version of the library under the
 * same terms as jsmin.c, which has the following license:
 *
 * --
 * Copyright (c) 2002 Douglas Crockford  (www.crockford.com)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do
 * so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * The Software shall be used for Good, not Evil.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 * --
 *
 * @package JSMin
 * @author Ryan Grove <ryan@wonko.com>
 * @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
 * @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
 * @license http://opensource.org/licenses/mit-license.php MIT License
 * @version 1.1.1 (2008-03-02)
 * @link http://code.google.com/p/jsmin-php/
 */
namespace Common\Extend;
class JSMin {
  const ORD_LF    = 10;
  const ORD_SPACE = 32;

  protected $a           = '';
  protected $b           = '';
  protected $input       = '';
  protected $inputIndex  = 0;
  protected $inputLength = 0;
  protected $lookAhead   = null;
  protected $output      = '';

  // -- Public Static Methods --------------------------------------------------

  public static function minify($js) {
    $jsmin = new JSMin($js);
    return $jsmin->min();
  }

  // -- Public Instance Methods ------------------------------------------------

  public function __construct($input) {
    $this->input       = str_replace("\r\n", "\n", $input);
    $this->inputLength = strlen($this->input);
  }

  // -- Protected Instance Methods ---------------------------------------------

  protected function action($d) {
    switch($d) {
      case 1:
        $this->output .= $this->a;

      case 2:
        $this->a = $this->b;

        if ($this->a === "'" || $this->a === '"') {
          for (;;) {
            $this->output .= $this->a;
            $this->a       = $this->get();

            if ($this->a === $this->b) {
              break;
            }

            if (ord($this->a) <= self::ORD_LF) {
              throw new JSMinException('Unterminated string literal.');
            }

            if ($this->a === '\\') {
              $this->output .= $this->a;
              $this->a       = $this->get();
            }
          }
        }

      case 3:
        $this->b = $this->next();

        if ($this->b === '/' && (
            $this->a === '(' || $this->a === ',' || $this->a === '=' ||
            $this->a === ':' || $this->a === '[' || $this->a === '!' ||
            $this->a === '&' || $this->a === '|' || $this->a === '?')) {

          $this->output .= $this->a . $this->b;

          for (;;) {
            $this->a = $this->get();

            if ($this->a === '/') {
              break;
            } elseif ($this->a === '\\') {
              $this->output .= $this->a;
              $this->a       = $this->get();
            } elseif (ord($this->a) <= self::ORD_LF) {
              throw new JSMinException('Unterminated regular expression '.
                  'literal.');
            }

            $this->output .= $this->a;
          }

          $this->b = $this->next();
        }
    }
  }

  protected function get() {
    $c = $this->lookAhead;
    $this->lookAhead = null;

    if ($c === null) {
      if ($this->inputIndex < $this->inputLength) {
        $c = $this->input[$this->inputIndex];
        $this->inputIndex += 1;
      } else {
        $c = null;
      }
    }

    if ($c === "\r") {
      return "\n";
    }

    if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
      return $c;
    }

    return ' ';
  }

  protected function isAlphaNum($c) {
    return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
  }

  protected function min() {
    $this->a = "\n";
    $this->action(3);

    while ($this->a !== null) {
      switch ($this->a) {
        case ' ':
          if ($this->isAlphaNum($this->b)) {
            $this->action(1);
          } else {
            $this->action(2);
          }
          break;

        case "\n":
          switch ($this->b) {
            case '{':
            case '[':
            case '(':
            case '+':
            case '-':
              $this->action(1);
              break;

            case ' ':
              $this->action(3);
              break;

            default:
              if ($this->isAlphaNum($this->b)) {
                $this->action(1);
              }
              else {
                $this->action(2);
              }
          }
          break;

        default:
          switch ($this->b) {
            case ' ':
              if ($this->isAlphaNum($this->a)) {
                $this->action(1);
                break;
              }

              $this->action(3);
              break;

            case "\n":
              switch ($this->a) {
                case '}':
                case ']':
                case ')':
                case '+':
                case '-':
                case '"':
                case "'":
                  $this->action(1);
                  break;

                default:
                  if ($this->isAlphaNum($this->a)) {
                    $this->action(1);
                  }
                  else {
                    $this->action(3);
                  }
              }
              break;

            default:
              $this->action(1);
              break;
          }
      }
    }

    return $this->output;
  }

  protected function next() {
    $c = $this->get();

    if ($c === '/') {
      switch($this->peek()) {
        case '/':
          for (;;) {
            $c = $this->get();

            if (ord($c) <= self::ORD_LF) {
              return $c;
            }
          }

        case '*':
          $this->get();

          for (;;) {
            switch($this->get()) {
              case '*':
                if ($this->peek() === '/') {
                  $this->get();
                  return ' ';
                }
                break;

              case null:
                throw new JSMinException('Unterminated comment.');
            }
          }

        default:
          return $c;
      }
    }

    return $c;
  }

  protected function peek() {
    $this->lookAhead = $this->get();
    return $this->lookAhead;
  }
}

// -- Exceptions ---------------------------------------------------------------
class JSMinException {}
//class JSMinException extends Exception {}
?>

聯(lián)絡(luò)方式:

中國 · 天津市河西區(qū)南京路35號亞太大廈1403室
電話:15620613686
郵編:300220

白胖老肥熟女A片免费播放-各种流量变现加飞机@NN131455-女人A级毛片19毛水真多-中文字幕穴触手 | home高清在线观看日本-久久久久久久中文精品字幕久久久免费国产-97无码大牛-国产免费一区二区三区三州老师F1F1.CC | a一级无码免费视频在线观看-看久久久久a级毛片免费-国产精品jiua-淫妇骚逼 | 狠狠色噜噜狠狠狠777-一级内谢毛片-曰本久久久 久久爱综合网-jizzjizzjizzjizz成熟的管 | 免费观看美女自慰网站-中文字幕亚洲无限码一-大胸妹子被操-风间由美人妻黑人NTR | 公交车伸入裙底揉捏1v1h无码-大乳奶一级婬片A片无码-液液一级黄色影院-内射北条麻妃 | 一本道在线中文字幕-茄子视频app懂你更多下载-jj桶美女-越南女人大荫蒂高潮 | 老师穿着粘满精子的丝袜漫画3D-亚洲精品456播放-黑人激情网-殴美A片 | AV电影一本道不卡-啊哦灬嗯灬用力灬快白洁-51nba直播免费观看入口-靠逼网址大全 | 巨乳美女自慰-免费三级在线观看中文字幕-超清电影全集观看 国产麻豆Av一区二区三区夏竹-色噜噜狠狠狠狠色综合久一 | 香港佬中文娱乐在线se-国产美女自慰白浆高潮-亚洲美女自慰口爆-国产四十路 | 性色av蜜臀av浪潮av老女人-少妇半推半就69XX-999久久久国产-国产一区二区在线观看网站 | 欧美高潮精汇编合集-国产剧动漫在线观看 久久久综合视频-BD英语免费高清观看 中日精品无码一本二本三本-亚洲av成人一区二区三区在线播放 | 午夜在线日韩免费精品福利-国产av无码专区毛片-欧洲freexxxx性少妇播放-无码精品人妻一二三区红粉影视 亚洲A∨ | 无码免费一区二区三区-热无码热中文视频-邻居浪荡3p嗯~啊-亚洲日本黄色 | 一a一级片-18以下岁禁止1000部在线-影视资源全麵同步更新-番茄AV导航 | 水野朝明 人妻紧缚-日韩欧美国产一区二区三区四区 国产精品国产专区国产三级-影音先锋 官场自拍-久久精品国产亚州av麻豆 | 中文字幕HEYZ0毛片-狠狠干视频第五页视频第五页视频第五页视频第五页视频第五页视频-欧美越南妇女XX-国产CHinese精品露脸 | 女同囗交 荫蒂-精品国产92一区二区三区-小倩有码视频-日韩嘿咻在线 | 小穴好湿好湿太爽了电影-a4yy午夜福利-亚洲熟妇xxxxx欧...-美女大尺度一抽一插 | 长腿大奶美女自慰-亚洲国产第一区二区三区-国产成人精品白浆久久69 -中国女人一级一次看片 | 熟女露脸91Porn-中国女人内射69-北条麻妃黑人-久久这里只有精品久久 | 人妻熟人中文字幕一区二区-少妇沈君系列人妻-国产亚洲美女精品久久久2020-淫语对白XXXXHD | 91seX海角社区- 国产亚洲精品自在久久77电影-免费人妻精品一区二区三区四区-朝鲜妇女扒B自慰 | 喂奶2 一色桃子-九九国产高清在线观看-放荡老师久久-嫩呦国产一区二区三区 | 琪琪大香蕉-狠狠爱h艹-老外后入在线观看-伊人做爱网 | 北条麻妃精品青青久久-真紧H太好c了h出轨视频-人妻大股屁-亚洲情se | play欧美国产-china粗话对白videos-荷兰一级特黄A片免费看-中文字幕综合网 | 东北少妇21p-亚洲日本va中文字幕亚洲-极度颤抖抽搐videos-99热这里有精品 | 亚洲色欧美 -亚洲熟女厕拍-Chinese国产麻豆tubeSeX-国产91睡熟迷奷系列精品 | 国产美女丝袜高潮白浆的游戏视频-草草成人福利影院-亚洲女厕偷拍一区二区-在线你懂的熟女 | 黄色片BB-女教师一级特黄大国产-成人美女裸体视频免费在线观看-自拍偷拍无码短视频 | 狠狠色噜噜狠狠狠777-一级内谢毛片-曰本久久久 久久爱综合网-jizzjizzjizzjizz成熟的管 | 性涩AV性爱网-大色网小色网淫色网-欧美黄色A片久久熟女人妻免费A片-神马影视 | 91us1-免费观看a级网站-姓色中色在线电影-黑人解禁中文字幕 | 欧美老熟妇又粗又大8888-日本人妻少妇久久中文字幕乱码-女主很sao放荡的H文-538在线视频一区二区三区四区五区六 | 国产第十页-日韩精品人妻系列无码专区免费-啊啊啊好爽用力操骚逼-93精品国产成人观看 | 草莓成人在线视频 jealousvue成熟-jlzzjlzz大全女高潮-熟女肥臀白浆大屁股一区二区-青苹果一区二区AV | 国产20页-色香AV-中文字幕高h-日韩在线视频免费 | gogogo免费视频观看 高清国语-无码午夜福利片在线观看-91丨PORNY|黑人-东北骚女人 | 日本特黄a级视频 日本在线观看永久免费网站-三p被狂躁到高潮失禁电影-无码人妻AⅤ一区二区三区A片一三级高清无码-久久综合九色综合欧美播 |