本文整理汇总了PHP中Object::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::send方法的具体用法?PHP Object::send怎么用?PHP Object::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::send方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
/**
* send mail
*
* array or object of type you set while initialize service
* @param Object|array $mail
*
* @throws \Exception $ex
*
* @return Mail
*/
public function sendMail($mail)
{
if (!is_array($mail)) {
try {
$arrayMail = $mail->toArray();
} catch (\Exception $ex) {
throw new \Exception('impossible to convert ' . get_class($mail) . ' to mail array');
}
} else {
$arrayMail = $mail;
}
$this->openTransport();
$header = $arrayMail['header'];
$sendingMail = $this->convertor->convertToSendFormat($arrayMail);
// prn($sendingMail->toString());
try {
$this->transport->send($sendingMail);
} catch (\Exception $ex) {
//create checking exception to output normal view, that describes problem to user
throw new \Exception('Mail format exception. Asc administrator to fix the problem');
// throw $ex;
}
$headers = $sendingMail->getHeaders()->toArray();
if (isset($headers['Message-ID'])) {
$header['message-id'] = $headers['Message-ID'];
}
if (is_array($mail)) {
$mail['header'] = $header;
} else {
$mail->header = $header;
}
$this->closeTransport();
return $mail;
}
示例2: haltForm
public function haltForm(Object $Object, $method = 'edit')
{
if ($method == 'add') {
if ($Object->Id) {
$Object->send();
}
}
return parent::haltForm($Object, $method);
}
示例3: testSetGetPath
/**
* 正常系 ログファイルのパスが取得できるか
*
* @covers Lib\SwiftMailer\Mailer::getPath()
* @test testSetGetPath()
*/
public function testSetGetPath()
{
$body = 'hello twig';
$this->object->setFrom($GLOBALS['MAIL_FROM']);
$this->object->setName($GLOBALS['MAIL_NAME']);
$this->object->setMessage('タイトル', $body);
$this->object->send('test@example.com');
$res = $this->object->getPath();
$this->assertInternalType('string', $res);
}
示例4: testSendAttachmentNormal
/**
* 正常系 添付画像を含むメッセージを返すか
*
* @covers Lib\SwiftMailer\Mailer::send()
* @test testSetSendAttachmentNormal()
*/
public function testSendAttachmentNormal()
{
$body = $this->object->setTemplate('defaultTest.twig', array('name' => '太郎'));
$this->object->setAttachment('tests/imgs/test.jpg', 'image/jpeg', 'test');
$this->object->setFrom($GLOBALS['MAIL_FROM']);
$this->object->setName($GLOBALS['MAIL_NAME']);
$this->object->setMessage('添付画像テスト', $body);
$res = $this->object->send('test@example.com');
$this->assertEquals(1, $res);
}
示例5: send
/** Send message via connector to recorder host.
*
* @param $payload
*/
public function send(\StdClass $payload)
{
$this->connector->send($payload);
}
示例6: run
/**
* Main dispatcher
*
* @return void
*/
public function run()
{
/* Only Ajax requests allowed */
if (!$this->Request->isAjax()) {
die('No direct access!');
}
/* Check if an action is given */
if (empty($this->Request->data['action'])) {
$ret = json_encode(array('success' => false, 'message' => 'No action specified'));
print_r($ret);
die;
}
/* Dispatch the action */
switch ($this->Request->data['action']) {
case 'take_foto':
$data = $this->Camera->takeFoto();
if (empty($data)) {
$this->Response->setError('Failed to take a foto');
} else {
$this->Response->setPayload($data);
}
break;
case 'hardcopy':
$this->hardcopy($_POST['filename']);
break;
case 'cancel':
echo "Starting over...";
die;
// unset($_SESSION);
// session_destory();
break;
case 'save_picture':
if (!empty($this->Request->data['imageData'])) {
$im = imagecreatefromstring(base64_decode(substr($this->Request->data['imageData'], 22)));
if ($im === false) {
$this->Response->setError('imagecreatefromstring() failed');
} else {
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'pictures' . DIRECTORY_SEPARATOR . uniqid() . '.jpg';
if (!imagejpeg($im, $filename, 100)) {
$this->Response->setError('imagejpeg() failed');
} else {
$this->Response->setMessage($filename);
}
}
imagedestroy($im);
}
break;
case 'get_camera_option':
$attr = $_GET['attr'];
$val = shell_exec(sprintf('/usr/bin/v4l2-ctl --get-ctrl %s', $attr));
$this->Response->setMessage($val);
break;
case 'set_camera_option':
$attr = $_GET['attr'];
$value = intval($_GET['val']);
shell_exec(sprintf('/usr/bin/v4l2-ctl --set-ctrl %s=%d', $attr, $value));
break;
// case 'startvideostream':
// $this->Camera->startVideoStream();
// break;
// case 'stopvideostream':
// $this->Camera->stopVideoStream();
// break;
// case 'startvideostream':
// $this->Camera->startVideoStream();
// break;
// case 'stopvideostream':
// $this->Camera->stopVideoStream();
// break;
default:
$this->Response->setError('Invalid action: ' . $this->Request->data['action']);
}
$this->Response->send();
}
示例7: getResponse
/**
* Fetch the response from the request
*
* @version 1.0
* @since 1.0
* @author Daniel Noel-Davies
*
* @param Object $request Guzzle Request Object
*
* @return Object Guzzle Response
*/
public static function getResponse($request)
{
return \Cache::remember($request->getUrl(), 60, function () use($request) {
// Send the request and store the response
try {
$response = $request->send();
} catch (\Guzzle\Http\Exception\ServerErrorResponseException $e) {
\Cache::forget($request->getUrl());
sleep(5);
$response = self::getResponse($request);
}
return $response;
});
}