我正在关注一篇博文(链接不再可用)并将memcached添加到services.yml
parameters:
memcached.servers:
- { host: 127.0.0.1, port: 11211 }
services:
memcached:
class: Memcached
calls:
- [ addServers, [ %memcached.servers% ]]
Run Code Online (Sandbox Code Playgroud)
然后在我的控制器中:
$memcached = $this->get('memcached');
Run Code Online (Sandbox Code Playgroud)
看起来很漂亮.如果我能过去的话500 - You have requested a non-existent service "memcached"!
来自php的测试代码连接到memcached没有任何麻烦.完成缓存:手动清除,清除缓存 - 没有帮助.
我应该在哪里看?
是否有一种全局方法可以检测音频何时在浏览器中播放或开始播放。
类似的想法 if(window.mediaPlaying()){...
没有将代码绑定到特定元素?
编辑:这里重要的是无论音频来自何处,都能够检测到任何音频。无论是来自 iframe、视频、Web Audio API 等。
我试图在symfony中使用monolog记录一个数组.
$logger = $this->get('logger');
$logger->info(=print_R($user,true));
Run Code Online (Sandbox Code Playgroud)
我得到的输出没有格式化为print_r.它将所有内容记录在一行上.
我的config.yml中没有任何monolog设置,并怀疑这可能是问题所在.
如何使用monolog记录print_r(数组),以便显示格式为tail -f?
我已经为我的映射文件尝试了这个目录结构:
/config/doctrine/Place.orm.yml
/config/doctrine/Place/Type.orm.yml
/config/doctrine/Place/Price.orm.yml
Run Code Online (Sandbox Code Playgroud)
并在我的映射文件中指向了相应的实体,如下所示:
Project\TestBundle\Entity\Place\Type:
type: entity
table: place_type
id:
id:
type: integer
generator: { strategy:AUTO }
fields:
name:
type: string
length: 255
Run Code Online (Sandbox Code Playgroud)
但这会返回错误.系统似乎无法检测到Entity的映射文件.
如果条目时间戳与今天的日期匹配,我想从SQLite表中选择所有条目.
我正在查询SQLite数据库,如下所示:
// Tasks table name
private static final String TABLE_TASKS = "tasks";
// Tasks Table Columns names
private static final String KEY_ID = "id";
private static final String KEY_TIMESTAMP = "timestampGMT";
private static final String KEY_DESCRIPTION = "description";
String selectQuery = "SELECT * FROM " + TABLE_TASKS + " WHERE "+ KEY_TIMESTAMP+">=date('now', '-1 day')";
Run Code Online (Sandbox Code Playgroud)
这种行为是我最接近的行为,但我不希望在过去24小时内选择所有条目.我只想选择今天的日期是否与时间戳匹配.
如何仅选择表中时间戳与今天日期匹配的行.
日期格式为:2014-07-05 12:59:35在数据库中.
所以我刚开始使用Phpstorm,我正在尝试"更正"我的代码,因此IDE没有错误.我在下面有以下方法,所有我的xml标签都突出显示'未知HTML标记'
纠正这个问题的最佳方法是什么?
private function generate_qbxml_CustomerAddRq($requestID=0){
/** requestID is used when multiple requests are called in order to match the request to the response.
requestID's should be incremented as they are called. Currently not implimented. **/
$qbxml = '';
$qbxml .= '<?xml version="1.0" encoding="utf-8"?>';
$qbxml .= '<?qbxml version="2.0"?>';
$qbxml .= '<QBXML>';
$qbxml .= '<QBXMLMsgsRq onError="stopOnError">';
$qbxml .= '<CustomerAddRq requestID="'.$requestID.'">';
$qbxml .= '<CustomerAdd>';
$qbxml .= '<Name>'.$this->Name.'</Name>'; //Name is a mandatory field. Add a check for this.
/** For all optional values …Run Code Online (Sandbox Code Playgroud) 我有以下课程:
namespace AppBundle\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use FOS\UserBundle\Event\UserEvent;
use FOS\UserBundle\FOSUserEvents;
use FOS\UserBundle\Event\FormEvent;
class UserRegistrationListener implements EventSubscriberInterface
{
protected $logger;
public function __construct($logger)
{
$this->logger = $logger;
}
public static function getSubscribedEvents()
{
return array(
FOSUserEvents::REGISTRATION_INITIALIZE => 'onRegistrationInit',
);
}
/**
* take action when registration is initialized
* set the username to a unique id
* @param \FOS\UserBundle\Event\FormEvent $event
*/
public function onRegistrationInit(UserEvent $userevent)
{
$this->logger->info("Log Something");
$user = $userevent->getUser();
$user->setUsername(uniqid());
}
}
Run Code Online (Sandbox Code Playgroud)
而且我一直在努力用几个小时的时间记录一下monolog的东西,但没有运气.
我已经阅读了很多文档,我相信我需要以某种方式'注入'monolog作为服务.然而,我所读到的内容似乎并不清楚.
一些细节:
#config_dev.yml
monolog:
channels: [chris]
handlers: …Run Code Online (Sandbox Code Playgroud) symfony ×4
android ×2
monolog ×2
audio-player ×1
doctrine-orm ×1
intellij-13 ×1
java ×1
javascript ×1
laravel ×1
logging ×1
media-player ×1
memcached ×1
phpstorm ×1
sqlite ×1
yaml ×1