{"id":473,"date":"2013-07-03T13:53:23","date_gmt":"2013-07-03T05:53:23","guid":{"rendered":"http:\/\/www.ln.la\/?p=473"},"modified":"2013-07-03T13:53:23","modified_gmt":"2013-07-03T05:53:23","slug":"pecl-pear-php-extensions","status":"publish","type":"post","link":"https:\/\/www.lnlog.cn\/index.php\/2013\/07\/03\/pecl-pear-php-extensions\/","title":{"rendered":"\u4f7f\u7528Pecl\u6216Pear\u5b89\u88c5PHP\u6269\u5c55"},"content":{"rendered":"<p>PHP\u5b98\u65b9\u79ef\u7d2f\u4e86\u5927\u91cf\u7531\u5168\u4e16\u754c\u7684PHPer\u7cbe\u5fc3\u5199\u7684\u5f00\u6e90\u6269\u5c55\uff0c\u5176\u4e2dPECL(The PHP Extension Community Library)\u662f\u4e00\u4e2aC\u8bed\u8a00\u6e90\u7801\u683c\u5f0f\u7684\u6269\u5c55\u4ed3\u5e93\uff0cPEAR(the PHP Extension and Application Repository)\u662f\u4e00\u4e2aPHP\u6269\u5c55\u53ca\u5e94\u7528\u7684\u4ee3\u7801\u4ed3\u5e93\uff0c\u4e8c\u8005\u4e0d\u540c\u7684\u662fPECL\u63d0\u4f9b\u6e90\u4ee3\u7801\uff0c\u800cPEAR\u76f8\u5f53\u4e8e\u4e00\u4e2aPHP\u7684\u7c7b\u5e93\u3002<\/p>\n<p>\u65e5\u5e38\u5f00\u53d1\u5927\u90e8\u5206\u529f\u80fd\u90fd\u53ef\u4ee5\u5728\u8fd9\u91cc\u627e\u5230\u6210\u719f\u7684\u6269\u5c55\u5305\uff0c\u4e0d\u9700\u8981\u53bb\u4e00\u4e00\u5b9e\u73b0\u3002\u4f8b\u5982memcache\uff0c\u5728ubuntu\u4e0b\u53ef\u4ee5\u4f7f\u7528sudo pecl install memcache\u5b89\u88c5\uff0c\u5b8c\u6210\u540e\u7cfb\u7edf\u4f1a\u81ea\u52a8\u7f16\u8bd1\u6210\u52a8\u6001\u5e93\u6587\u4ef6\uff0c\u53ea\u9700\u8981\u914d\u7f6e\u597dphp.ini\u4e2d\u7684extension\u5373\u53ef\uff0c\u7136\u540esudo apt-get install memcached\u5b89\u88c5\u5ba2\u6237\u7aef\u540e\u53ef\u4ee5\u4f7f\u7528memcache\u4e86\u3002<\/p>\n<p>PEAR\u7684\u4f7f\u7528\u66f4\u4e3a\u7b80\u5355\uff0c\u9996\u5148\u5982\u679c\u7cfb\u7edf\u6ca1\u6709\u5b89\u88c5pear\u53ef\u4ee5\u76f4\u63a5apt-get\u65b9\u5f0f\u5b89\u88c5\u597d\uff0c\u7136\u540e\u76f4\u63a5\u4f7f\u7528pear\u547d\u4ee4\u83b7\u53d6\u6269\u5c55\u5305\uff0c\u4ee5\u5b89\u88c5SMTP\u6269\u5c55\u5305\u4e3a\u4f8b\uff1a<\/p>\n<p><!--more--><\/p>\n<div id=\"highlighter_451410\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>1<\/code><\/td>\n<td><code>pear <\/code><code>install<\/code> <code>Mail-1.2.0<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>2<\/code><\/td>\n<td><code>pear <\/code><code>install<\/code> <code>Net_SMTP<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<p>\u5b89\u88c5\u6210\u529f\u540e\u5728\/usr\/share\/php\u6587\u4ef6\u4e2d\u4f1a\u6709\u4e00\u4e2aMail.php\u548cMail\u6587\u4ef6\u5939\uff0c\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\uff1a<\/p>\n<div id=\"highlighter_678944\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>01<\/code><\/td>\n<td><code>include<\/code> <code>'Mail.php'<\/code><code>;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>02<\/code><\/td>\n<td><code>$headers<\/code><code>[<\/code><code>'Content-Type'<\/code><code>] = <\/code><code>'text\/html;charset=utf-8'<\/code><code>;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>03<\/code><\/td>\n<td><code>$headers<\/code><code>[<\/code><code>'From'<\/code><code>]\u00a0\u00a0\u00a0 = <\/code><code>'noreply@yoursite.com'<\/code><code>;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>04<\/code><\/td>\n<td><code>$headers<\/code><code>[<\/code><code>'To'<\/code><code>]\u00a0\u00a0\u00a0\u00a0\u00a0 = <\/code><code>$email<\/code><code>;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>05<\/code><\/td>\n<td><code>$headers<\/code><code>[<\/code><code>'Subject'<\/code><code>] = <\/code><code>'\u90ae\u4ef6\u6807\u9898'<\/code><code>;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>06<\/code><\/td>\n<td><code>$params<\/code><code>[<\/code><code>\"host\"<\/code><code>] = <\/code><code>'smtp.yoursite.com'<\/code><code>;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>07<\/code><\/td>\n<td><code>$params<\/code><code>[<\/code><code>\"auth\"<\/code><code>] = true;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>08<\/code><\/td>\n<td><code>$params<\/code><code>[<\/code><code>\"username\"<\/code><code>] = <\/code><code>'username'<\/code><code>;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>09<\/code><\/td>\n<td><code>$params<\/code><code>[<\/code><code>\"password\"<\/code><code>] = <\/code><code>'password'<\/code><code>;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>10<\/code><\/td>\n<td><code>$params<\/code><code>[<\/code><code>\"debug\"<\/code><code>] = false;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>11<\/code><\/td>\n<td><code>$mail_object<\/code> <code>= &amp; Mail::factory(<\/code><code>'smtp'<\/code><code>, <\/code><code>$params<\/code><code>);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>12<\/code><\/td>\n<td><code>$mail_object<\/code><code>-&gt;send(<\/code><code>$email<\/code><code>, <\/code><code>$headers<\/code><code>, <\/code><code>$content<\/code><code>);<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u5b98\u65b9\u79ef\u7d2f\u4e86\u5927\u91cf\u7531\u5168\u4e16\u754c\u7684PHPer\u7cbe\u5fc3\u5199\u7684\u5f00\u6e90\u6269\u5c55\uff0c\u5176\u4e2dPECL(The PHP Extension C &hellip; <a href=\"https:\/\/www.lnlog.cn\/index.php\/2013\/07\/03\/pecl-pear-php-extensions\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u4f7f\u7528Pecl\u6216Pear\u5b89\u88c5PHP\u6269\u5c55<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[64,65,66],"class_list":["post-473","post","type-post","status-publish","format-standard","hentry","category-tech","tag-pear","tag-pecl","tag-php"],"_links":{"self":[{"href":"https:\/\/www.lnlog.cn\/index.php\/wp-json\/wp\/v2\/posts\/473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lnlog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lnlog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lnlog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lnlog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=473"}],"version-history":[{"count":0,"href":"https:\/\/www.lnlog.cn\/index.php\/wp-json\/wp\/v2\/posts\/473\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lnlog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lnlog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lnlog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}