search
Homephp教程php手册仿微博php生成短网址,仿微博php

仿微博php生成短网址,仿微博php

html code

<span><!</span><span>DOCTYPE html</span><span>></span>  
<span><</span><span>html </span><span>lang</span><span>="en"</span><span>></span>  
<span><</span><span>head</span><span>></span>  
  <span><</span><span>meta </span><span>charset</span><span>="utf-8"</span> <span>/></span>  
  <span><</span><span>title</span><span>></span>urlShort<span></</span><span>title</span><span>></span>  
<span></</span><span>head</span><span>></span>  
  
<span><</span><span>body</span><span>></span>  
  <span><</span><span>form </span><span>action</span><span>="urlShort.php"</span><span> method</span><span>="post"</span><span>></span>  
    <span><</span><span>input </span><span>type</span><span>="text"</span><span> size</span><span>="16"</span><span> name</span><span>="url"</span><span> value</span><span>="输入网址"</span><span> onfocus</span><span>="if(this.value=='输入网址'){this.value='';}"</span><span> onblur</span><span>="if(this.value==''){this.value='输入网址'};"</span><span>></span>  
    <span><</span><span>input </span><span>type</span><span>="submit"</span><span> value</span><span>=" 生成 "</span> <span>/></span>  
  <span></</span><span>form</span><span>></span>  <span><</span><span>a </span><span>href</span><span>="http://hovertree.com"</span><span>></span>何问起<span></</span><span>a</span><span>></span>
<span></</span><span>body</span><span>></span>  
<span></</span><span>html</span><span>></span>  

 php code

<?<span>php  
     </span><span>header</span>("Content-Type:text/html;charset=UTF-8"<span>);    
     </span><span>function</span> base62(<span>$x</span><span>){  
        </span><span>$show</span> = ''<span>;  
        </span><span>while</span>(<span>$x</span>>0<span>){  
            </span><span>$s</span> = <span>$x</span> % 62<span>;  
            </span><span>if</span> (<span>$s</span> > 35<span>){  
                </span><span>$s</span> = <span>chr</span>(<span>$s</span> + 61<span>);  
            }</span><span>else</span> <span>if</span> (<span>$s</span> > 5 && <span>$S</span><=35<span>){  
                </span><span>$s</span> = <span>chr</span>(<span>$s</span> + 55<span>);  
            }  
            </span><span>$show</span> .= <span>$s</span><span>;  
            </span><span>$x</span> = <span>floor</span>(<span>$x</span>/62<span>);  
        }  
        </span><span>return</span> <span>$show</span><span>;  
    }  </span><span>/*</span><span> 何问起 hovertree.com </span><span>*/</span>
      
    <span>function</span> url_short(<span>$url</span><span>){  
        </span><span>$url</span> = <span>crc32</span>(<span>$url</span><span>);  
        </span><span>$result</span> = <span>sprintf</span>("%u",<span>$url</span><span>);   
        </span><span>return</span> base62(<span>$result</span><span>);  
    }  
      
    </span><span>echo</span> ("生成的新网址为:<a href='http://<span>$_POST</span>[url]'>".url_short(<span>$_POST</span>['url'])."</a>"<span>);  
</span>?>

推荐:http://www.cnblogs.com/roucheng/p/3528396.html

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.