Giter VIP home page Giter VIP logo

php_c_shortlink's Introduction

php_c_shortlink

php c扩展实现的url短链接生成,php extentsion short_link

在此要特别感谢,香蕉和fermi的用心指导

安装方法 install

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config

make

make install

使用方法

$url = "http://www.abc.om/def/ghi.php";
$pre_url = "http://a.cn";
$arr = shorlink($url);
$short_url = $pre_url.$arr[0];

$arr类似下面的数组,返回4个可用的短链,随便取一个即可。

  array(4) {
    [0]=>
    string(6) "9Syv1C"
    [1]=>
    string(6) "Tyb5GO"
    [2]=>
    string(6) "a5eDi1"
    [3]=>
    string(6) "1C0W9S"
  }

根据以下php算法改写的 c生成php扩展,在性能提升了3倍。

> 5; } $short_url_list[] = $short_url; } return $short_url_list; } } $url = "http://www.cnblogs.com/zemliu/"; $short = Short_Url::short($url); print_r($short); ?>

php_c_shortlink's People

Contributors

viewuse avatar caoygx avatar

Watchers

起飞小王子 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.