|
1.yii通过phpMailer发送邮件
$max_len=80; //60
$mailer = Yii::app()->phpMailer->_mailer;
//----------------
$mailer->Subject =$subject;
//$body= preg_replace('/\\\\/','', $body);
$mailer->Body =$body;
//$mailer->AltBody ="不支持HTML显示.\r\n".$body;
$mailer->AddAddress($send_mail); // 收件人邮箱和姓名 //,get_email_name($send_mail)
//--------------------
$mailer->AddEmbeddedImage(YII::app()->basePath.'\\..\\images\\logo.jpg', 'fy_logo', 'logo.jpg','base64','image/jpeg' ); //设置邮件中的图片
//---------------
$attachment=trim($attachment);
//$attachment=strtoupper($attachment);
if(count($attachments)>0){
foreach($attachments as $a){
$f_contents = file_get_contents($a['file']); //获取远程图片或本地图片
if( !empty($attachment[$i]['title']) ){
$name = $attachment[$i]['title'];
}else{
$name = basename($a['file']);
}
$mailer->AddStringAttachment($f_contents, $name,'base64','application/octet-stream');
}
}
//--------------------
if(strlen($subject)<=0) return 'ERROR:主题为空.';
if(strlen($body)<=0) return 'ERROR:内容为空.';
if(strlen($body)>$max_len){
$mailer->WordWrap = $max_len; // set word wrap 换行字数
}
//-----------------
if(!$mailer->Send()) return $mailer->ErrorInfo;
else return true;
环境php54w
2.php安装phalcon框架
#Ubuntu
sudo apt-get install gcc make git-core libpcre3-dev php5-dev
#Suse
sudo yast -i gcc make php5-devel
#or
sudo zypper install gcc make php5-devel
#CentOS/Fedora/RHEL
sudo yum install git gcc make pcre-devel php-devel
如果还是报错
yum install php54w-devel
#Solaris
pkg install gcc-45 php-53 apache-php53
3.安装cphalcon
git clone git://github.com/phalcon/cphalcon.git
cd cphalcon/build
sudo ./install
4.在/etc/php.d文件夹下新建一个文件phalcon.ini文件内容如下:
extension=pdo.so
5.重启tengine 与 php-fpm两个服务
windows下安装
1.下载php_phalcon.dll文件(注:文件要与php版本对应)
2.放到ext文件夹下就可以了
3.重启apache与php服务
windows系统中,php链接sqlserver安装下面两个扩展:
php_pdo_sqlsrv_52_nts.dll
php_pdo_sqlsrv_52_ts.dll
SQL Server Native Client这个驱动程序,根据数据库版本来,目前我用的是sql server 2008,对应的SQL Server Native Client 11.0
重启apache就好了
linux系统中,php链接sqlserver配置:
1.安装编译工具及驱动程序
yum install make apr* autoconf automake gcc gcc-c++ wget
2.安装unixODBC驱动程序
yum -y install unixODBC unixODBC-devel
3.安装freetds
cd /usr/local/src
wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz #下载
gunzip freetds-stable.tgz #解压
tar -xvf freetds-stable.tar
cd freetds-0.91
./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --with-unixodbc=/usr --enable-msdblib #配置
make #编译
make install #安装
4.配置freetds
cp /usr/local/freetds/etc/freetds.conf /usr/local/freetds/etc/freetds.confbak
vi /usr/local/freetds/etc/freetds.conf #在最后位置修改编辑以下内容
[192.168.21.134]
host = 192.168.21.134 #SQL Server 2000服务器地址
port = 1433 #SQL Server 2000数据库端口
tds version = 8.0 #8.0代表数据库版本为SQL Server 2000
client charset = UTF-8 #设置字符集为utf-8
#client charset = GBK #设置字符集为gbk
|
|
|