我怎么刷新令牌?我使用带有此令牌的Google api - 它可以工作但无法找到如何刷新它,在这个例子中我们不保存过期时间.我需要
`access_type: offline `
Run Code Online (Sandbox Code Playgroud)
然后
$client = new Google_Client();
//$client->setClientId($GoogleClientId);
$client->setApplicationName($GoogleAppName);
$client->setClientId($this->user->getGoogleId());
$client->setAccessType('offline');
Run Code Online (Sandbox Code Playgroud)
如果令牌有效,我可以工作但是什么时候过期我试试
$token = [
'access_token' => $this->user->getGoogleAccessToken(),
'expires_in' => (new \DateTime())->modify('-1 year')->getTimestamp(),
];
Run Code Online (Sandbox Code Playgroud)
我把它放在任何日期,因为在这个例子中我们不保存过期时间
https://gist.github.com/danvbe/4476697
$client->setAccessToken($token);
if($client->isAccessTokenExpired()){
$refreshedToken = $client->refreshToken($client->getAccessToken());
Run Code Online (Sandbox Code Playgroud)
我有错误
array:2 [?
"error" => "invalid_request"
"error_description" => "Could not determine client ID from request."
]
Run Code Online (Sandbox Code Playgroud)
有HwiAuthBundle方法来刷新令牌吗?为什么这不适用于Google_Client刷新?
我安装了Sonata admin Bundle,一切正常但我没有任何语言 - 管理员中的按钮和文本就像之前的翻译示例:
label.select_context,btn_filter(不过滤但是btn_filter)
和其他 - 我可以在哪里设置语音奏鸣曲管理员?
今天更新作曲家包后,我收到错误消息.
ClassNotFoundException in SncRedisExtension.php line 158:
Attempted to load class "Factory" from namespace "Predis\Profile".
Did you forget a "use" statement for "Buzz\Message\Factory\Factory"?
Run Code Online (Sandbox Code Playgroud)
这个配置工作了一段时间 - 现在停止,我的身边没有任何变化.
这是我的Composer.json包
"php": ">=5.3.3",
"symfony/symfony": "2.6.*",
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0,>=3.0.12",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"stof/doctrine-extensions-bundle": "~1.1@dev",
"a2lix/translation-form-bundle": "1.*@dev",
"html2text/html2text": "dev-master",
"liuggio/statsd-client-bundle": "1.6.*",
"weotch/phpthumb": "dev-master",
"egeloen/google-map-bundle": "*",
"oh/google-map-form-type-bundle": "dev-master",
"meenie/javascript-packer": "dev-master",
"natxet/CssMin": "dev-master",
"apy/datagrid-bundle": "dev-master",
"webit/sms-common": "dev-master",
"webit/smsapi": "dev-master",
"webit/smsapi-bundle": "dev-master",
"ddeboer/data-import": "dev-master",
"endroid/qrcode": "1.*@dev",
"knplabs/knp-snappy-bundle": "^1.2", …
Run Code Online (Sandbox Code Playgroud) 我尝试标注
* @Cache(expires="+10 hours", public=false)
Run Code Online (Sandbox Code Playgroud)
或在控制器中
$maxAge = 60*60;
$response->setExpires(Carbon::create()->addHour());
$response->setSharedMaxAge($maxAge);
$response->setPublic();
$response->setMaxAge($maxAge);
Run Code Online (Sandbox Code Playgroud)
而且还有 Cache-Control: max-age=0, must-revalidate, private
应用使用会话,用户正在登录-我想要-缓存私有,但没有任何效果-我总是能得到这个。
我已经添加 FOS\HttpCacheBundle\FOSHttpCacheBundle()
(只需添加)希望它能覆盖symfony缓存并允许将发送缓存设为私有-但什么都不会改变。
是否可以使用Facebook API创建活动?
API v1中有可能:
https://developers.facebook.com/docs/graph-api/reference/v1.0/event#publish
但不是在v2(当前版本):
https://developers.facebook.com/docs/graph-api/reference/v2.0/event#publish
我可以使用v1吗?还有其他方法在PHP应用程序中创建Facebook事件吗?
我正在使用Select2 4.0.0-rc.2。
“ 选项”页面指出以下内容:initSelection
过去,Select2要求
initSelection
在使用自定义数据源时就定义一个选项,从而可以确定组件的初始选择。它已由数据适配器current
上的方法代替。
我仅找到了使用的旧版本Select2的示例initSelection
(请参阅使用Ajax在Select2上设置加载时的初始值)
如何使用数据适配器加载默认数据?
这是我的初始代码(是树枝)
$("#{{ id }}").select2({
ajax: {
url: "{{ path(attr.path) }}",
dataType: 'json',
{% if attr.placeholder is defined %}
placeholder: '{{ attr.placeholder }}',
{% endif %}
delay: 250,
data: function (term) {
return term;
},
processResults: function (data) {
return {results: data};
}
},
templateResult: function(data){
return '<img width="30" src="'+data.image+'">'+data.text;
},
templateSelection: function(data){
return '<img width="30" src="'+data.image+'">'+data.text;
},
cache: true,
escapeMarkup: function (markup) …
Run Code Online (Sandbox Code Playgroud) 我尝试添加全局参数
所有路由的参数,以及内核请求侦听器中的参数设置.
路由
mea_crm:
resource: @Crm4Bundle/Resources/config/routing.yml
prefix: /{_applicationid}
defaults: { _applicationid: 0 }
requirements:
_applicationid: |0|1|2|3|4|5|6
Run Code Online (Sandbox Code Playgroud)
在Listener中 - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
我尝试设置此参数
$request->attributes->add(array(
'_applicationid'=>$appCurrentId
));
$request->query->add(
array(
'_applicationid'=>$appCurrentId
)
);
$request->query->set('_applicationid',$appCurrentId);
Run Code Online (Sandbox Code Playgroud)
仍然有路线 - 默认值0
更新1我将侦听器设置为最高优先级
tags:
- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 255 }
Run Code Online (Sandbox Code Playgroud)
在监听器设置中
public function onKernelRequest(GetResponseEvent $event)
{
$event->getRequest()->request->set('_applicationid',1);
return ;
Run Code Online (Sandbox Code Playgroud)
并且仍然没有这个参数是路由.
更新2
它很奇怪 - 我在Symfony\Component\Routing\Router中转储
在方法中
public function matchRequest(Request $request)
....
var_dump($matcher->matchRequest($request));
die();
Run Code Online (Sandbox Code Playgroud)
得到
array(size = 4)'_ console'=> string'Mea\TaskBundle\Controller\TaskListController …
我有奇怪的错误只有id prod模式.它显示在页面视图(在apache错误日志中)或任何终端操作,如此处.
grek@grek-Inspiron-11-3147:~/PhpstormProjects/mea.crm4/www$ sudo rm -rf app/cache/*
[sudo] password for grek:
grek@grek-Inspiron-11-3147:~/PhpstormProjects/mea.crm4/www$ php app/console cache:clear
Clearing the cache for the dev environment with debug true
grek@grek-Inspiron-11-3147:~/PhpstormProjects/mea.crm4/www$ php app/console cache:clear --env=prod
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "assetic.helper.static" has a dependency on a non-existent service "assets.packages".
Run Code Online (Sandbox Code Playgroud)
我得到的服务器错误日志
[Thu Sep 10 16:33:35.726563 2015] [:error] [pid 1552] [client 127.0.0.1:47870] PHP Fatal error: Uncaught exception 'Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException' with message 'The service "assetic.helper.static" has a dependency on a non-existent service "assets.packages".' in /home/grek/PhpstormProjects/mea.crm4/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:58\nStack trace:\n#0 /home/grek/PhpstormProjects/mea.crm4/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(42): Symfony\\Component\\DependencyInjection\\Compiler\\CheckExceptionOnInvalidReferenceBehaviorPass->processReferences(Array)\n#1 /home/grek/PhpstormProjects/mea.crm4/www/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(36): Symfony\\Component\\DependencyInjection\\Compiler\\CheckExceptionOnInvalidReferenceBehaviorPass->processDefinition(Object(Symfony\\Component\\DependencyInjection\\Definition))\n#2 in …
Run Code Online (Sandbox Code Playgroud) 我正试图从实体中获取一个多维数组.
Symfony Serializer已经可以转换为XML,JSON,YAML等,但不能转换为数组.
我需要转换,因为我想干净var_dump
.我现在有几个连接的实体,完全不可读.
我怎样才能做到这一点?
我从备份中复制symfony2应用程序.我删除缓存并尝试使用composer install或composer update - get error
PHP Fatal error: Class 'Doctrine\Common\Cache\ArrayCache' not found in /home/div/app/cache/dev/appDevDebugProjectContainer.php on line 1033
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
Run Code Online (Sandbox Code Playgroud)
这是我的 composer.json
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" , "mea":"vendor/Mea/CoreBundle/"}
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4", …
Run Code Online (Sandbox Code Playgroud) services.yml
services:
_defaults:
autowire: true
autoconfigure: true
public: true
Run Code Online (Sandbox Code Playgroud)
控制器:
/**
* @Security("has_role('ROLE_USER')")
* @Route("/", name="homepage")
*/
public function indexAction(ContactService $contactService)
{
Run Code Online (Sandbox Code Playgroud)
错误
:indexAction()" requires that you provide a value for the "$contactService" argument.
Run Code Online (Sandbox Code Playgroud)
我对本示例工作应采取的措施(向控制器方法自动注入服务)
我完成了aciton,不知道如何获得paymentDetails对象...
这是手册:http: //payum.forma-dev.com/documentation/0.8/PayumBundle/purchase_done_action
我尝试从http://payum.forma-dev.com/documentation/0.8/PayumBundle/simple_purchase_examples/paypal_express_checkout之前的步骤获取对象PaymentDetails
UPDATE1
public function doneAction(){
$request = $this->getRequest();
/**
* @var $token PayumSecurityToken
*/
$token = $this->get('payum.security.http_request_verifier')->verify($request);
/**
* @var $details PaymentDetails
*/
$details = $token->getDetails();
var_dump($details);
Run Code Online (Sandbox Code Playgroud)
给
object(Payum\Core\Model\Identificator)[345]
protected 'class' => string 'ed\partnerBundle\Entity\PaymentDetails' (length=38)
protected 'id' => int 1
Run Code Online (Sandbox Code Playgroud)
UPDATE2
$details = unserialize($token->getDetails());
ContextErrorException: Notice: unserialize(): Error at offset 0 of 40 bytes in /home/grek/public_html/edpartner/src/ed/partnerBundle/Controller/PaymentController.php line 110
Run Code Online (Sandbox Code Playgroud) symfony ×10
php ×8
doctrine-orm ×2
caching ×1
google-api ×1
jquery ×1
payum ×1
predis ×1
routing ×1
sonata-admin ×1
symfony-3.4 ×1