目前我正在开发项目,我需要使用API访问Google Calenadar数据 - 一切正常但我无法获得事件开始时间/结束时间 - 最重要的信息.
我正在使用Zend框架和Zend_Gdata库,遗憾的是zend的文档并不详细
如何获得所需的事件数据?或者我应该使用另一个图书馆?
这是我获取事件Feed的功能:
public function getEvents($future_only = TRUE,$force_refresh = FALSE) {
if (($this->events != NULL) && $force_refresh == FALSE) {
return $this->events;
} else {
if ($this->getService() != NULL) {
$service = $this->getService();
try {
$query = $service->newEventQuery($this->url);
$query->setUser(null);
$query->setProjection(null);
$query->setVisibility(null);
$query->setOrderby('starttime');
if ($future_only) {
$query->setFutureevents('true');
} else {
$query->setFutureevents('false');
}
$event_feed = $service->getCalendarEventFeed($query);
$this->events = $event_feed;
return $event_feed;
} catch (Exception $exc) {
.
.
.
return NULL;
}
} else {
return …Run Code Online (Sandbox Code Playgroud) 我正在尝试发送带有图片的电子邮件; 我的电子邮件正文是:
<?php
$message = <<< email
<img src="http://planet-earth.bogus.us/icons/secret.pictures.gif">
Dear {$email},
email;
?>
Run Code Online (Sandbox Code Playgroud)
当我收到电子邮件时,我看不到图片.相反,我明白了<img src="http://planet-earth.bogus.us/icons/secret.pictures.gif">.我知道这是因为<<<电子邮件; 如何使用<<<电子邮件显示图片而不是代码?
UPDATE
我正在使用zend-framework.我的代码看起来像这样:
<?php
$mail = new Zend_Mail();
$mail->setFrom('admin@mysite.com', 'My site');
$mail->addTo($recoveryaccount->username);
$mail->setSubject("Mysite");
include "_email_recover_password.phtml";
$mail->setBodyText($message);
$mail->send();
?>
_include "_email_recover_password.pthml"
<?php
$message = <<< email
<img src="http://picturelocation.picture.gif">
Dear {$account->getUsername()},
Somebody has requested that the password associated with this account be
reset. If you initiated this request, click the below link to complete the process:
http://www.example.com/{$account->getRecovery()}
Thank you!
Mysite
Questions? Contact us at admin@mysite.com …Run Code Online (Sandbox Code Playgroud) 我的zend布局和脚本检测正常.但是在我的IndexController的init函数中,我写了$ this-> view-> render("header.phtml")它没有显示屏幕上的任何内容,而当我写回信时($ this-> view-> render(" header.phtml");它显示我的header.phtml文件.这是我的IndexController
class IndexController扩展Zend_Controller_Action {
public function init()
{
$layout = $this->_helper->layout();
//$this->view = $this->getResource('View');
echo ($this->view->render("header.phtml"));
//echo"<pre>";
//var_dump($this->view);
//var_dump(APPICATION_PATH);
}
public function indexAction()
{
// action body
echo "In default index con";
}
Run Code Online (Sandbox Code Playgroud)
}
另外,当Igive我的url到/ mypath/index它没有显示简单的行"我在索引控制器中",我只是回应.在我的引导程序中,这是我的Zend_Layout设置.
Zend_Loader::loadClass('Zend_View');
$this->view = new Zend_View();
$this->view->setEncoding('UTF-8');
$this->view->setScriptPath($this->root .'/application/default/views/scripts');
$viewRenderer=new Zend_Controller_Action_Helper_ViewRenderer();
// Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
// $view->setScriptPath($this->root.'/'.$theme.'/views/scripts/');
//$view->setScriptPath($this->root.'/application/default/views/scripts/');
$this->view->addScriptPath($this->root.'/application/admin/views/scripts');
$this->view->addScriptPath($this->root.'/application/business/views/scripts');
// $this->view->setHelperPath($this->root .'/application/default/views/helpers');
$this->layout = Zend_Layout::startMvc(
array(
'layoutPath' => $this->root . '/application/default/views/'.$crt_theme.'/layouts',
'layout' => 'layout'
)
);
$this->registry->set("theme", $crt_theme);
Run Code Online (Sandbox Code Playgroud)
变量$ …
创建包含所有应用程序常量变量的类的最佳位置在哪里?
它是: - Bootstrap
- 在Application Common库中
例如:1-当我从数据库中检索图像名称时,如果此记录没有图像,我想在某处放置一个默认值,以便我可以在我的模型中使用它
**我在我的所有应用程序中使用的常量,所以如果我更改它,我不想回到我的代码中的所有代码并在任何地方更改它
我刚刚将Zend项目上传到我的CentOS服务器.我正在使用Doctrine ORM,所以这要求我说明我正在使用的命名空间.
我的项目在我的Windows机器上运行正常,但是当我尝试在服务器上运行它时,我得到了
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in ************/Bootstrap.php on line 2
Run Code Online (Sandbox Code Playgroud)
错误.第2行是
use Doctrine\ORM\EntityManager,
Doctrine\ORM\Configuration;
Run Code Online (Sandbox Code Playgroud)
我对Linux很新,也许我认为它的Linux有问题我错了,所以如何解决这个错误呢?
谢谢
我忘记了如何从Zend Framework的application.ini中设置PHP配置设置.
我想设置max_execution_time变量.
请帮帮我.
阅读本文后我对此表示怀疑.我已经读过几种形式和文章,php是一种解释语言,即使我发现Stackoverflow也是如此,但是当我从这里读到它时我感到很困惑.任何人都可以通过某些经过验证的链接或引用来解释这一点.
3评论后添加: - 文章说: -
PHP became a compiled language in the year 2000, when PHP 4 was released for the first time. Until version 3, PHP source code was parsed and executed right away by the PHP interpreter.
请不要在没有查看精神文章的情况下提出您的答案.我在阅读完这篇文章后得到了怀疑,对于本文的内容我更加苛刻,
我已经为我的网站编写了一个基本的索引脚本,它看起来有点...... 它通过它需要索引的大约3/4页面,然后给出这个错误:
致命错误:第166行/Zend/Search/Lucene/Analysis/Analyzer.php超过0秒的最大执行时间
它似乎每次都挂在不同的地方.我跑了一分钟后得到了这个:
致命错误:第349行的/Zend/Search/Lucene/Storage/Directory/Filesystem.php超出了0秒的最大执行时间
这是脚本:
foreach($all_items as $item) {
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Text('title', $item['pagetitle']));
$doc->addField(Zend_Search_Lucene_Field::Text('url', $item['url']));
$doc->addField(Zend_Search_Lucene_Field::Text('country', $item['country']));
// Add document to the index
$index->addDocument($doc);
}
Run Code Online (Sandbox Code Playgroud) 我在Zend_Auth会话上设置超时有问题这是我的代码:
$authSession = new Zend_Session_Namespace('Zend_Auth');
$authSession->setExpirationSeconds(60*60*24*1);
Run Code Online (Sandbox Code Playgroud)
此代码应使会话在1天后过期,但实际会话在约30分钟后到期.谁知道什么是错的?谢谢.
祝你好运!我有一个问题:在网页上有一个表格.它的行动指向自己.但是在提交表单后,如果网页被非法刷新,您将再次提交表单!这怎么可以避免?没有找到任何解决方案.
HTML代码:
<form method="POST" action="" name="new_branch"
onsubmit="return validateForm()">
blah blah blah
</form>
在服务器端
if($this->_request->isPost()) { //code here }
Run Code Online (Sandbox Code Playgroud)
你如何"重置"帖子?