php方便 iconFont打包

直接上效果图:

上代码

<?php header("Content-type:text/html;charset=utf-8");  ?>
<html>
<title>iconfont tools</title>
<h1>赵大财专版released1.0 翻版不纠 2016.5.11</h1>
<form action="res.php" method="post">
   <textarea rows="10" cols="50" name="css">
      http://at.alicdn.com/t/font_1462962687_6478822.css
   </textarea>
    <br>

    <input type="submit" value="获取" />

</form>

</html>


<?php
/**
 * Created by PhpStorm.
 * User: point
 * Date: 16/5/11
 * Time: 下午6:57
 */
set_time_limit(1800) ;
//读取网页内容

//$data = file_get_contents($_POST["css"]);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, trim($_POST["css"]));
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl)."<hr><hr><hr><hr><hr><hr>";
curl_close($curl);

//.icon-loginagreen:before
preg_match_all("/.icon-(.*):before/sU",$data,$title);
preg_match_all("/{ content: (.*); }/sU",$data,$haha);
$arr =(explode(" ",$title[1]));

$i=0;
foreach($title[1] as $v){
    echo "static NSString *kIcon_".$v."=@".$haha[1][$i].";"."<br>";
    $i++;
}

 

转载于:https://my.oschina.net/zhaodacai/blog/673716

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值