本文整理汇总了PHP中Vendor函数的典型用法代码示例。如果您正苦于以下问题:PHP Vendor函数的具体用法?PHP Vendor怎么用?PHP Vendor使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Vendor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
Vendor('Form.Form2');
$this->form = new Form('__APP__/Friend_links/Friend_links_addok', 'friend_links');
$this->form->_addBaseElement('friend_links');
parent::__construct();
}
示例2: kxw_sendMail
function kxw_sendMail($content, $to)
{
Vendor('PHPMailer.PHPMailerAutoload');
$mail = new PHPMailer();
//实例化
$mail->IsSMTP();
// 启用SMTP
$mail->Host = C('MAIL_HOST');
//smtp服务器的名称(这里以126邮箱为例)
$mail->SMTPAuth = C('MAIL_SMTPAUTH');
//启用smtp认证
$mail->Username = C('MAIL_USERNAME');
//你的邮箱名
$mail->Password = C('MAIL_PASSWORD');
//邮箱密码
$mail->From = C('MAIL_FROM');
//发件人地址(也就是你的邮箱地址)
$mail->FromName = C('MAIL_FROMNAME');
//发件人姓名
$mail->AddAddress('2952810774@qq.com', "name");
$mail->WordWrap = 50;
//设置每行字符长度
$mail->IsHTML(C('MAIL_ISHTML'));
// 是否HTML格式邮件
$mail->CharSet = C('MAIL_CHARSET');
//设置邮件编码
$mail->Subject = 'Complaint';
//主题
$mail->Body = $content . '</br>' . "telphone:" . $to;
//内容
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
//正文不支持HTML的备用显示
return $mail->Send();
}
示例3: SendMail
/**
*
* @param unknown $address
* @param unknown $title
* @param unknown $message
* @return Ambigous <boolean, string>
*
*/
function SendMail($address, $title, $message)
{
Vendor('PHPMailer.PHPMailerAutoload');
$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 = 'Hello World';
// 设置邮件标题
$mail->Subject = $title;
// 设置SMTP服务器。
$mail->Host = C('MAIL_SMTP');
// 设置为"需要验证" ThinkPHP 的C方法读取配置文件
$mail->SMTPAuth = true;
// 设置用户名和密码。
$mail->Username = C('MAIL_LOGINNAME');
$mail->Password = C('MAIL_PASSWORD');
// 发送邮件。
return $mail->Send() ? true : $mail->ErrorInfo;
}
示例4: sendMail
/**
*
*/
function sendMail($to, $title, $content)
{
Vendor('PHPMailer.PHPMailerAutoload');
$mail = new PHPMailer();
//实例化
$mail->IsSMTP();
// 启用SMTP
$mail->Host = C('MAIL_HOST');
//smtp服务器的名称(这里以QQ邮箱为例)
$mail->SMTPAuth = C('MAIL_SMTPAUTH');
//启用smtp认证
$mail->Username = C('MAIL_USERNAME');
//你的邮箱名
$mail->Password = C('MAIL_PASSWORD');
//邮箱密码
$mail->From = C('MAIL_FROM');
//发件人地址(也就是你的邮箱地址)
$mail->FromName = C('MAIL_FROMNAME');
//发件人姓名
$mail->AddAddress($to, "尊敬的客户");
$mail->WordWrap = 50;
//设置每行字符长度
$mail->IsHTML(C('MAIL_ISHTML'));
// 是否HTML格式邮件
$mail->CharSet = C('MAIL_CHARSET');
//设置邮件编码
$mail->Subject = $title;
//邮件主题
$mail->Body = $content;
//邮件内容
$mail->AltBody = "这是一个纯文本的身体在非营利的HTML电子邮件客户端";
//邮件正文不支持HTML的备用显示
return $mail->Send();
}
示例5: remove
public function remove()
{
//删除指定记录
$result = array('isErr' => 0, 'content' => '');
$id = $_REQUEST['id'];
if (!empty($id)) {
Vendor('common');
$model = D("EventShare");
$condition = array("share_id" => array('in', explode(',', $id)));
$list = $model->where($condition)->findAll();
if (false !== $model->where($condition)->delete()) {
foreach ($list as $k => $v) {
M("Event")->setDec('thread_count', 'id=' . $v['event_id']);
// 减1
}
D("Share")->removeHandler($id);
$this->saveLog(1, $id);
} else {
$result['isErr'] = 1;
$result['content'] = L('REMOVE_ERROR');
}
} else {
$result['isErr'] = 1;
$result['content'] = L('ACCESS_DENIED');
}
die(json_encode($result));
}
示例6: logo
public function logo()
{
Vendor("phpqrcode.phpqrcode");
$QRcode = new \QRcode();
$path = "data/rq/";
$value = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?token=' . session('token');
$fileName = $path . session('token') . '_emall.png';
$QR_Logo = $path . session('token') . '_emall_Logo.png';
$errorCorrectionLevel = 'H';
$matrixPointSize = 10;
$QRcode->png($value, $fileName, $errorCorrectionLevel, $matrixPointSize, 2);
$logo = $path . 'weixinlogo.jpg';
$QR = $fileName;
if ($logo !== FALSE) {
$QR = imagecreatefromstring(file_get_contents($QR));
$logo = imagecreatefromstring(file_get_contents($logo));
$QR_width = imagesx($QR);
$QR_height = imagesy($QR);
$logo_width = imagesx($logo);
$logo_height = imagesy($logo);
$logo_qr_width = $QR_width / 5;
$scale = $logo_width / $logo_qr_width;
$logo_qr_height = $logo_height / $scale;
$from_width = ($QR_width - $logo_qr_width) / 2;
imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
}
imagepng($QR, $QR_Logo);
$this->assign('QR_Logo', $QR_Logo);
$this->display();
if (IS_AJAX) {
$response = $this->fetch();
$this->ajaxReturn(1, '', $response);
}
}
示例7: remove
public function remove()
{
//删除指定记录
$result = array('isErr' => 0, 'content' => '');
$id = $_REQUEST['id'];
if (!empty($id)) {
Vendor('common');
$model = D("Event");
$pk = $model->getPk();
$condition = array($pk => array('in', explode(',', $id)));
$list = $model->where($condition)->findAll();
if (false !== $model->where($condition)->delete()) {
foreach ($list as $k => $v) {
D("Share")->removeHandler($v['share_id']);
$post_share_ids = D("EventShare")->where("event_id=" . $v['id'])->field("share_id")->findAll();
foreach ($post_share_ids as $k => $share_ids) {
D("Share")->removeHandler($share_ids['share_id']);
}
$model->where("event_id=" . $v['id'])->delete();
}
$this->saveLog(1, $id);
} else {
$result['isErr'] = 1;
$result['content'] = L('REMOVE_ERROR');
}
} else {
$result['isErr'] = 1;
$result['content'] = L('ACCESS_DENIED');
}
die(json_encode($result));
}
示例8: phpRPCAct
public function phpRPCAct()
{
Vendor('phpRPC.phprpc_client');
$client = new \PHPRPC_Client('http://localhost:8500/Api/RpcTest');
$result = $client->test();
dump($result);
}
示例9: filterData
/**
* 过滤数据 重组
* @param array $data
* @param array $modelfield
*/
public function filterData($data = array(), $modelfield = array())
{
$newmodelfield = $this->parseModelField($modelfield);
$newdata = $data;
foreach ($data as $k => $d) {
if (key_exists($k, $newmodelfield)) {
switch ($newmodelfield[$k]['type']) {
case 'editor':
//编辑器过滤XSS
Vendor('Htmlpurifier.library.HTMLPurifier#auto');
$config = \HTMLPurifier_Config::createDefault();
$purifier = new \HTMLPurifier($config);
$newdata[$k] = $purifier->purify(htmlspecialchars_decode($d));
break;
case 'position':
//推荐位
$newdata[$k] = implode(',', $d);
break;
case 'checkbox':
$newdata[$k] = implode(',', $d);
break;
}
}
}
return $newdata;
}
示例10: index
public function index()
{
function bar($x)
{
if ($x > 0) {
bar($x - 1);
}
}
function foo()
{
for ($idx = 0; $idx < 5; $idx++) {
bar($idx);
$x = strlen("abc");
}
}
//开启调试
xhprof_enable();
// cpu:XHPROF_FLAGS_CPU 内存:XHPROF_FLAGS_MEMORY
// 如果两个一起:XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
//要测试的php代码
foo();
//停止监测
$xhprof_data = xhprof_disable();
// display raw xhprof data for the profiler run
print_r($xhprof_data);
//包含工具类,在下载的 tgz 包中可以找到
//$XHPROF_ROOT = realpath(dirname(__FILE__) .'/..');
Vendor('Xhprof.autoload');
//Vendor('Xhprof.xhprof_runs');
//include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
//include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";
// save raw data for this profiler run using default
// implementation of iXHProfRuns.
}
示例11: run
/**
+----------------------------------------------------------
* 应用程序初始化
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return void
+----------------------------------------------------------
*/
public static function run()
{
// 设定错误和异常处理
set_error_handler(array('App', "appError"));
set_exception_handler(array('App', "appException"));
//[RUNTIME]
// 检查项目是否编译过
// 在部署模式下会自动在第一次执行的时候编译项目
if (defined('RUNTIME_MODEL')) {
// 运行模式无需载入项目编译缓存
} elseif (is_file(RUNTIME_PATH . '~app.php') && (!is_file(CONFIG_PATH . 'config.php') || filemtime(RUNTIME_PATH . '~app.php') > filemtime(CONFIG_PATH . 'config.php'))) {
// 直接读取编译后的项目文件
C(include RUNTIME_PATH . '~app.php');
} else {
// 预编译项目
App::build();
}
//[/RUNTIME]
//导入类库
Vendor('Zend.Amf.Server');
//实例化AMF
$server = new Zend_Amf_Server();
$actions = explode(',', C('APP_AMF_ACTIONS'));
foreach ($actions as $action) {
$server->setClass($action . 'Action');
}
echo $server->handle();
// 保存日志记录
if (C('LOG_RECORD')) {
Log::save();
}
return;
}
示例12: sendMail
/**
* 发送邮件函数
* @param $email 邮件接收邮箱
* @param $name 接收人NAME
* @param $string 邮件标题
* @param $content 接收内容
*/
function sendMail($email, $name, $title, $content)
{
Vendor('PHPMailer.PHPMailerAutoload');
$mail = new PHPMailer();
//建立邮件发送类
$mail->IsSMTP();
// 使用SMTP方式发送
$mail->Host = C('MAIL_HOST');
// 您的企业邮局域名
$mail->SMTPAuth = C('MAIL_SMTPAUTH');
// 启用SMTP验证功能
$mail->SMTPSecure = 'ssl';
$mail->Username = C('MAIL_USERNAME');
// 邮局用户名(请填写完整的email地址)
$mail->Password = C('MAIL_PASSWORD');
// 邮局密码
$mail->Port = 465;
$mail->From = C('MAIL_FROM');
//邮件发送者email地址
$mail->FromName = C('MAIL_FROMNAME');
//发件人姓名
$mail->CharSet = "utf-8";
$mail->Encoding = "base64";
$mail->AddAddress("{$email}", "{$name}");
//收件人email","收件人姓名
$mail->Subject = "{$title}";
//邮件标题
$mail->IsHTML(TRUE);
$mail->Body = "{$content}";
//邮件内容
return $mail->Send();
}
示例13: sentEmail
function sentEmail($data)
{
//加载第三方类swift,实现发送邮件功能
Vendor('swift.lib.swift_required');
//发送邮件,以QQ邮箱为例
//配置邮箱服务器,得到传输对象
$transport = \Swift_SmtpTransport::newInstance(C('EM_SERVER'), C('EM_PORT'));
//设置登录帐号和密码
$transport->setUsername(C('EM_USERNAME'));
$transport->setPassword(C('EM_PASSWORD'));
//得到发送邮件对象Swift_Mailer对象
$mailer = \Swift_Mailer::newInstance($transport);
//得到邮件信息对象
$message = \Swift_Message::newInstance();
//设置管理员信息
$message->setFrom(array(C('EM_USERNAME') => C('EM_ADMIN')));
//设置接收邮件用户信息
$message->setTo($data['email']);
//设置邮件主题
$message->setSubject($data['sub']);
//设置邮件正文
$message->setBody("{$data['str']}", 'text/html', 'utf-8');
//发送邮件
try {
if ($mailer->send($message)) {
return true;
} else {
return false;
}
} catch (Swift_ConnectionExcption $e) {
echo '邮件发送失败';
return false;
}
}
示例14: download
public function download($bid = -1)
{
//准备试卷基本信息
$Bank = D('Bankview');
$bank = $Bank->find($bid);
$Exam = D('Examview');
$exam = $Exam->where('cid=' . "'" . $bank['cid'] . "'")->find();
$path = './Uploads/' . $bank['cid'] . '/' . $bank['tid'] . '/' . $bank['savename'];
$filename = $bank['id'] . '_' . $exam['coursename'] . '_' . $bank['teachername'] . '.pdf';
$Course = D('Course');
$course = $Course->find($bank['cid']);
//判断考试班级是否修改过
$classname = '';
if ($course['classlist'] != '') {
$classname = $course['classlist'];
} else {
$classname = $exam['classname'];
}
$school = get_info('INFO_SCHOOL');
$year = get_info('INFO_YEAR');
$term = get_info('INFO_TERM');
$type = get_info('INFO_TYPE');
//修改试卷
Vendor('Classes.TCPDF.PDF');
$pdf = new PDF();
$pdf->edit($path, $filename, $school, $bank['teachername'], '', $exam['systemname'], $year, $term, $type, $exam['coursename'], $classname, $course['type']);
}
示例15: SendMail
function SendMail($to, $title, $company, $contact, $phone, $email, $address, $content, $cname, $cqq)
{
header("Content-type: text/html; charset=utf-8");
Vendor('PHPMailer.PHPMailerAutoload');
$mail = new PHPMailer();
//实例化
$mail->IsSMTP();
// 启用SMTP
$mail->Host = C('MAIL_HOST');
//smtp服务器的名称(这里以QQ邮箱为例)
$mail->SMTPAuth = C('MAIL_SMTPAUTH');
//启用smtp认证
$mail->Username = C('MAIL_USERNAME');
//你的邮箱名
$mail->Password = C('MAIL_PASSWORD');
//邮箱密码
$mail->From = C('MAIL_FROM');
//发件人地址(也就是你的邮箱地址)
$mail->FromName = C('MAIL_FROMNAME');
//发件人姓名
$mail->AddAddress($to, "尊敬的客户");
$mail->WordWrap = 50;
//设置每行字符长度
$mail->IsHTML(C('MAIL_ISHTML'));
// 是否HTML格式邮件
$mail->CharSet = C('MAIL_CHARSET');
//设置邮件编码
$mail->Subject = $title;
//邮件主题
$mail->Body = '姓名:' . $cname . '<br/>公司:' . $company . '<br/>Content:' . $contact . '<br/>手机:' . $phone . '<br/>电子邮箱:' . $email . '<br/>地址:' . $address . '<br/>Content:' . $content . '<br/>QQ:' . $cqq;
//邮件内容
$mail->AltBody = "这是一个纯文本的身体在非营利的HTML电子邮件客户端";
//邮件正文不支持HTML的备用显示
return $mail->Send();
}