/*
*檢查路徑是否存在
*/
functioncheckDir($dir)
{
exec("/bin/ls$dir",$info,$status);
$sta=empty($info) ?$sta=1:$sta=0;//1路徑不存在,0路徑存在
return$sta;
}
//倉(cāng)庫(kù)是git還是svn
functionwarehouseCheck($warehouse)
{
if(preg_match("/.git$/i",$warehouse)) {
$sta=1;//1為git
}
if(preg_match("/^svn:\/\//i",$warehouse)) {
$sta=2;//2為svn
}
return$sta;
}
//環(huán)境選擇
functionenvCheck($env_name,$ser_tmp)
{
if(strpos($env_name,"測(cè)試") !==false) {
$dir_tmp="$ser_tmp/cs";
}elseif(strpos($env_name,"預(yù)發(fā)布") !==false) {
$dir_tmp="$ser_tmp/yfb";
}elseif(strpos($env_name,"正式") !==false||strpos($env_name,"線上") !==false) {
$dir_tmp="$ser_tmp/zs";
}else{
$dir_tmp="";
}
return$dir_tmp;
}
//發(fā)郵件
functionsendMail($to,$subject,$content,$send_user){
header("content-type:text/html;charset=utf-8");
ini_set("magic_quotes_runtime",0);
vendor("Phpmailer.phpmailer");
try{
$mail=newPHPMailer(true);//實(shí)例化
$mail->IsSMTP();// 啟用SMTP
$mail->CharSet='UTF-8';//設(shè)置郵件的字符編碼,這很重要,不然中文亂碼
$mail->SMTPAuth=true;//開(kāi)啟認(rèn)證
$mail->Port=25;
$mail->Host="smtp.exmail.qq.com";
$mail->Username="ops@feibo.cn";
$mail->Password="feibo54321";
//$mail->IsSendmail(); //如果沒(méi)有sendmail組件就注釋掉,否則出現(xiàn)“Could not execute: /var/qmail/bin/sendmail ”的錯(cuò)誤提示
//$mail->AddReplyTo("phpddt1990@163.com","mckee");//回復(fù)地址
$mail->From="ops@feibo.cn";
$mail->FromName=$send_user;
//$to = "linc@feibo.cn";
//dump($to);die;
foreach($toas$v){
$mail->AddAddress($v);
}
$content=str_replace('\n',"\",$content);
$mail->IsHTML(true);//支持html格式內(nèi)容
$mail->Subject=$subject;
$mail->Body= $content;
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; //當(dāng)郵件不支持html時(shí)備用顯示,可以省略
$mail->WordWrap=80;// 設(shè)置每行字符串的長(zhǎng)度
//$mail->AddAttachment("f:/test.png"); //可以添加附件
$mail->Send();
}catch(phpmailerException$e) {
echo"郵件發(fā)送失?。?.$e->errorMessage();
}
}
當(dāng)前標(biāo)題:PHP編寫一些檢查項(xiàng)函數(shù)
網(wǎng)頁(yè)路徑:http://sd-ha.com/article44/jsjohe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供微信公眾號(hào)、網(wǎng)站建設(shè)、做網(wǎng)站、定制網(wǎng)站、網(wǎng)站改版、自適應(yīng)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)