这是我的代码:
<?php
require_once 'Swift/lib/swift_required.php';
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465)
->setUsername('me@ff.com')
->setPassword('pass');
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Wonderful Subject')
->setFrom(array('me@ff.com' => 'MY NAME'))
->setTo(array('you@ss.com' => 'YOU'))
->setBody('This is the text of the mail send by Swift using SMTP transport.');
//$attachment = Swift_Attachment::newInstance(file_get_contents('path/logo.png'), 'logo.png');
//$message->attach($attachment);
$numSent = $mailer->send($message);
printf("Sent %d messages\n", $numSent);
?>
Run Code Online (Sandbox Code Playgroud)
跑出这个错误之后......
致命错误:未捕获异常'Swift_TransportException',消息'预期响应代码220但得到代码"",消息""在/home/sitenyou/public_html/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php:406
Stack trace:
#0 /home/sitenyou/public_html/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php(299): Swift_Transport_AbstractSmtpTransport->_assertResponseCode('', Array)
#1 /home/sitenyou/public_html/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php(107): Swift_Transport_AbstractSmtpTransport->_readGreeting()
#2 /home/sitenyou/public_html/Swift/lib/classes/Swift/Mailer.php(74): Swift_Transport_AbstractSmtpTransport->start()
#3 /home/sitenyou/public_html/sgmail.php(16): Swift_Mailer->send(Object(Swift_Message))
#4 {main} thrown in /home/sitenyou/public_html/Swift/lib/classes/Swift/Transport/AbstractSmtpTransport.php on line 406
Run Code Online (Sandbox Code Playgroud) 是否可以从sql日期条目中仅获取月份部分?
像日期一样存储'2011-01-06'.如果我只想获取'01'部分我该怎么办?
提前超过.xx
我想根据数据库日期条目找出一周中的哪一天.
例如:假设我从数据库中获取一个值,例如03-03-1988,我想打印星期一或星期二那天.我怎么能算出来?
提前超过..
请看我的代码:
function getShopConfig()
{
$sql = "SELECT sc_name, sc_address, sc_phone, sc_email, sc_shipping_cost, sc_order_email, cy_symbol, sc_currency
FROM kol_shop_config , kol_currency
WHERE sc_currency = cy_id";
$result = dbQuery($sql);
$row = dbFetchAssoc($result);
if ($row) {
//extract($row);
$shopConfig = array('name' => $row['sc_name'],
'address' => $row['sc_address'],
'phone' => $row['sc_phone'],
'email' => $row['sc_email'],
'sendOrderEmail' => $row['sc_order_email'],
'shippingCost' => $row['sc_shipping_cost'],
'currency' => $row['sc_currency']);
}
return $shopConfig;
}
Run Code Online (Sandbox Code Playgroud)
然后我称之为,
<td colspan="4" align="right"><?php getShopConfig(); echo $shopConfig['name'];?></td>
Run Code Online (Sandbox Code Playgroud)
但没有显示任何内容..错误在哪里?请帮忙.
注意:两者都在同一页面中.dbQuery()和dbFetchAssoc()函数是预定义的,之前已正常工作.如果我在函数内部回显它然后只是调用它然后它正常工作.