Heim  >  Artikel  >  php教程  >  PHP发短信 PEAR 包:Services_Sms

PHP发短信 PEAR 包:Services_Sms

WBOY
WBOYOriginal
2016-06-13 11:31:231087Durchsuche

PHP发短信 PEAR 包:Services_Sms

对于这种第三方库,PHP官方称之为PEAR,需要按照PEAR标准开发(标准URI)。

PEAR的优势:一键安装到php/lib/php目录,require即可使用,很方便。

由于项目要发短信,所以我开发了一个,现在整理开源出来。安装步骤如下:

pear channel-discover sinkcup.github.io/<span pear
pear </span><span install</span> sinkcup/Services_Sms

0.0.1版支持下列短信服务商:

移通网络:http://www.etonenet.com/

短信宝:http://smsbao.com/

互亿无限:http://ihuyi.com/

使用步骤:

1、到短信服务商网站注册一个帐号,比如移通网络(http://www.etonenet.com/)。

2、demo(参考https://github.com/sinkcup/Services_Sms/blob/master/tests/Services/SmsTest.php):

<?<span php
</span><span require_once</span> 'Services/Sms.php'<span ;
</span><span $conf</span> = <span array</span><span (
    </span>'spid' => 'foo',
    'sppassword' => 'bar',
    'apiUriPrefix' => 'http://esms.etonenet.com/',<span 
);
</span><span $c</span> = <span new</span> Services_Sms('etonenet', <span $conf</span><span );
</span><span $r</span> = <span $c</span>->send('13800138000', 'Hello!树先生 etonenet'<span );
</span><span var_dump</span>(<span $r</span><span );
</span><span exit</span><span ;
</span>?>

源代码:https://github.com/sinkcup/Services_Sms

sinkcup PEAR 频道:http://sinkcup.github.io/pear/

 

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn