本文整理匯總了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();
}