日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

compser可以检查php扩展吗,composer扩展

發布時間:2023/11/27 生活经验 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 compser可以检查php扩展吗,composer扩展 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

## 一些簡單的thinkphp擴展

1. 正則表達式的擴展:

PHP7以上:

```

composer req gherkins/regexpbuilderphp

```

PHP5

```

composer req gherkins/regexpbuilderphp:0.7.*

```

[使用文檔](https://github.com/gherkins/regexpbuilderphp/wiki)

[實例](https://github.com/gherkins/regexpbuilderphp)

2.Blade模板引擎擴展

```

composer require terranc/think-blade

```

[GitHub文檔](https://github.com/terranc/think-blade)

3.Twig模板引擎擴展

```

composer require yunwuxin/think-twig

```

[GitHub使用文檔](https://github.com/yunwuxin/think-twig)

4.Swoole擴展

```

composer require topthink/think-swoole

```

[GitHub使用文檔](https://github.com/top-think/think-swoole)

5.phpmailer擴展文件

```

composer?require?phpmailer/phpmailer

```

或者在composer.json中手動增加一個phpmailer require

```

"require": {

"php": ">=5.4.0",

"topthink/framework": "^5.0",

"topthink/think-image": "^1.0",

"topthink/think-captcha": "^1.0",

"topthink/think-mongo": "^1.0",

"topthink/think-migration": "^1.0",

"topthink/think-angular": "^1.0",

"topthink/think-sae": "^1.0",

"topthink/think-worker": "^1.0",

"topthink/think-queue": "^1.0",

"topthink/think-testing": "^1.0",

"phpmailer/phpmailer": "^5.2"

},

```

然后使用phpmailer類:

```

public function testmailer(){

$mail = new PHPMailer;

dump($mail);

}

```

打印結果:

```

object(PHPMailer)#5 (75) {

["Version"] => string(6) "5.2.16"

["Priority"] => NULL

["CharSet"] => string(10) "iso-8859-1"

["ContentType"] => string(10) "text/plain"

["Encoding"] => string(4) "8bit"

["ErrorInfo"] => string(0) ""

["From"] => string(14) "root@localhost"

["FromName"] => string(9) "Root User"

["Sender"] => string(0) ""

["ReturnPath"] => string(0) ""

["Subject"] => string(0) ""

["Body"] => string(0) ""

["AltBody"] => string(0) ""

["Ical"] => string(0) ""

["MIMEBody":protected] => string(0) ""

["MIMEHeader":protected] => string(0) ""

["mailHeader":protected] => string(0) ""

["WordWrap"] => int(0)

["Mailer"] => string(4) "mail"

["Sendmail"] => string(18) "/usr/sbin/sendmail"

["UseSendmailOptions"] => bool(true)

["PluginDir"] => string(0) ""

["ConfirmReadingTo"] => string(0) ""

["Hostname"] => string(0) ""

["MessageID"] => string(0) ""

["MessageDate"] => string(0) ""

["Host"] => string(9) "localhost"

["Port"] => int(25)

["Helo"] => string(0) ""

["SMTPSecure"] => string(0) ""

```

下一步為了分便使用可以把配置函數寫到common.php公共函數文件中如

```

function SendMail($address,$title,$message)

{

$mail=new \PHPMailer;

// 設置PHPMailer使用SMTP服務器發送Email

$mail->IsSMTP();

// 設置郵件的字符編碼,若不指定,則為'UTF-8'

$mail->CharSet='UTF-8';

// 添加收件人地址,可以多次使用來添加多個收件人

$mail->AddAddress($address);

// 設置郵件正文

$mail->Body=$message;

// 設置郵件頭的From字段。

$mail->From=C('MAIL_ADDRESS');

// 設置發件人名字

$mail->FromName='LilyRecruit';

// 設置郵件標題

$mail->Subject=$title;

// 設置SMTP服務器。

$mail->Host=C('MAIL_SMTP');

// 設置為"需要驗證"

$mail->SMTPAuth=true;

// 設置用戶名和密碼。

$mail->Username=C('MAIL_LOGINNAME');

$mail->Password=C('MAIL_PASSWORD');

// 發送郵件。

return($mail->Send());

}

```

6.thinkphp官方的擴展庫

[thinkphp5.1擴展庫地址](https://www.kancloud.cn/manual/thinkphp5_1/354126)

總結

以上是生活随笔為你收集整理的compser可以检查php扩展吗,composer扩展的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。