小编Ste*_*ant的帖子

为CloudFront禁用缓存

我正在使用自己的域通过CloudFront为HTTPS s3存储桶提供服务。我不希望它因为QA环境而被缓存。

我想知道我怎么能做到这一点。是使用Origin Cache Headers还是使用0生存时间进行自定义?

https amazon-s3 amazon-cloudfront

8
推荐指数
2
解决办法
5525
查看次数

无法在本地找到图像“名称:最新”

我正在尝试运行 postgres 容器并收到如下错误。

"Unable to find image 'name:latest' locally

docker: Error response from daemon: pull access denied for name, repository does not exist or may require 'docker login': denied: requested access to the resource is denied." 
Run Code Online (Sandbox Code Playgroud)

我已经研究这个问题几天了,我不知道问题是什么。

这是我的命令: 图像

postgresql docker docker-image

8
推荐指数
2
解决办法
4万
查看次数

file_put_contents(/root/.composer/cache/repo/https---flex.symfony.com/):无法打开流:是目录错误

我在 docker 容器中使用 composer install 构建了我的 symfony 4 应用程序。

作曲家版本 1.10.19

但我得到了这个错误。

[ErrorException] file_put_contents(/root/.composer/cache/repo/https---flex.symfony.com/): 无法打开流:是一个目录

如果我在没有任何中断的情况下再运行 composer install 1 次,则构建成功。

如果我删除项目目录上的 vendor 和 var/cache 目录,则会再次出现错误。

我试过这个方法:

  • 触发“composer clearcache”命令没有成功
  • 删除 ~/.composer 目录没有成功
  • chmod -R 777 ~/.composer 没有成功

在不同容器内构建相同项目的一些成功。我的容器以此卷开头:

  • 项目目录

  • ~/.ssh 目录

我在网上搜索但没有解决方案。请帮忙。

symfony composer-php docker symfony-flex

8
推荐指数
1
解决办法
568
查看次数

尝试刷新后,Token被取消了身份验证

我将我的Symfony环境从3.3更新到4.0.更新后我遇到登录问题(用户提供的数据库).当我提交登录表单时,我只是回到登录表单而没有任何错误消息.当我使用无效凭据时,我收到了相应的错误消息.这是尝试登录后的日志.使用"in_memory"用户提供程序登录正在运行.你需要更多的信息?

[2017-12-06 13:57:05] security.INFO: User has been authenticated successfully. {"username":"***"} []
[2017-12-06 14:22:39] doctrine.DEBUG: "START TRANSACTION" [] []
[2017-12-06 13:57:05] security.DEBUG: Read existing security token from the session. {"key":"_security_secured_area","token_class":"Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken"} []
[2017-12-06 13:57:05] doctrine.DEBUG: SELECT t0.username AS username_1, t0.password AS password_2, t0.email AS email_3, t0.email_new AS email_new_4, t0.first_name AS first_name_5, t0.last_name AS last_name_6, t0.is_active AS is_active_7, t0.email_confirmed AS email_confirmed_8, t0.shibboleth_state AS shibboleth_state_9, t0.shibboleth_hash AS shibboleth_hash_10, t0.shibboleth_persistent_id AS shibboleth_persistent_id_11, t0.confirmation_email_send AS confirmation_email_send_12, t0.last_login AS last_login_13, t0.expires AS expires_14, t0.session_id AS session_id_15, t0.id …
Run Code Online (Sandbox Code Playgroud)

php login symfony

7
推荐指数
1
解决办法
4556
查看次数

在 Shopware 6 中无法通过 XmlHttpRequest 请求 PageController

StorefrontController我正在尝试向我的客户发送有关最新 Shopware 的请求6.2.2,但收到以下错误:

PageController can't be requested via XmlHttpRequest.
Run Code Online (Sandbox Code Playgroud)

我正在httpClient从自定义 JS 插件发出常规请求:


export default class MyCustomPlugin extends Plugin {

  static options = {
      dataUrl: '', // comes from the twig as "path('frontend.path.to.route')"
      product: null,
      params: {},
      loadingIndicatorClass: 'is-loading',
      responseSelector: 'some-selector-class'

  }

  init () {
      // this.el.innerHTML = LoadingIndicator.getTemplate()
      this.httpClient = new HttpClient()
      const query = querystring.stringify(this.options.product)
      this.sendDataRequest(query)
  }

  /**
   * Add classes to add loading styling.
   * Prevents the user from clicking filter labels during …
Run Code Online (Sandbox Code Playgroud)

javascript ajax symfony symfony-routing shopware

7
推荐指数
1
解决办法
2858
查看次数

如何使用Google-Play-Purchase-Validator验证购买快递服务器

我想将Google Play应用内结算集成到已经获得payLoad json的统一项目中。我有一个Node.js服务器,并希望获得Google Play购买响应的价值,以便进行服务器端验证。

我在Google Play开发者控制台上列出的产品是create productId,但出现错误:

[错误:订阅购买令牌与订阅ID不匹配。]

在我的节点服务器的index.js文件中,我有一个像这样的段:

var Verifier = require('google-play-purchase-validator');
var options = {
    email: '#############-compute@developer.gserviceaccount.com',
    key: '-----BEGIN PRIVATE KEY-----##some private key##-----END PRIVATE KEY-----',
    keyFile: './Google Play Android Developer-############.json'
};
var verifier = new Verifier(options);
var receipt = {
    packageName:"com.natekgames.######",
    productId:"com.natekgames.######.diamond_48",
    purchaseToken:"ihfeaepjoppolibmeknoghmo.AO-J1OxbHPDa8QLVAU3OqvIa-ZgaAGWhrBhs8DyCEfFbbdTCH8ecvEXQlZtjkqaowPXujb0Osn_aOWBPMT0OpTMcivoQalEtOZmMhS2lDA7oH868NjZP2LgdE9ODafujNM7O9QQr3-hq"
};
verifier.verify(receipt, function cb(err, response){
    if(err){
        console.log("there was an error validating the receipt");
        console.log(err);
    }
    console.log("sucessfully validated the receipt");
    res.send(response);
});
Run Code Online (Sandbox Code Playgroud)

android unity-game-engine node.js express

6
推荐指数
1
解决办法
601
查看次数

Symfony 3.4自动服务

我正在开发Symfony 3.4中的迷你应用程序.我正在使用Guard整合身份验证过程.我创建了一个名为LoginFormAuthenticator的类,它扩展了AbstractFormLoginAuthenticator.

收货错误:

无法自动装配服务"app.security.login_form_authenticator":方法"AppBundle\Security\LoginFormAuthenticator :: __ construct()"的参数"$ em"引用类"Doctrine\ORM\EntityManager"但不存在此类服务.尝试将type-hint更改为其父项之一:interface"Doctrine\ORM\EntityManagerInterface",或接口"Doctrine\Common\Persistence\ObjectManager".

我的表单中的代码验证类:

    <?php

namespace AppBundle\Security;


use AppBundle\Form\LoginForm;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;

class LoginFormAuthenticator extends AbstractFormLoginAuthenticator
{
    private $formFactory;
    private $em;
    private $router;

    public function __construct(FormFactoryInterface $formFactory, EntityManager $em, RouterInterface $router)
    {

        $this->formFactory = $formFactory;
        $this->em = $em;
        $this->router = $router;
    }

    public function getCredentials(Request $request)
    {
        $isLoginSubmit = $request->getPathInfo() == '/login' && $request->isMethod('POST');

        if(!$isLoginSubmit){
            return false;
        }

        $form = …
Run Code Online (Sandbox Code Playgroud)

autowired symfony symfony-3.4

6
推荐指数
1
解决办法
3827
查看次数

什么意思是“由用户手势启动”。在 element.requestFullscreen() API 中?

我正在尝试使用elem.requestFullscreenAPI,但出现此错误(在 Ubuntu 上的 Chrome 70 上,未在其他浏览器上测试):

无法在“元素”上执行“requestFullscreen”:API 只能由用户手势启动。

这看起来像是一条明确的错误消息。我很高兴浏览器阻止开发人员在没有用户交互的情况下触发全屏事件。

但就我而言,我有一个带有点击事件的按钮。点击事件如何不是“用户手势”?我看过这个答案

这是我的代码:

let button = document.getElementById('toggle')

button.addEventListener('click', function ()
{
  let elem = document.getElementById('fullscreen')
   
  if (elem.requestFullscreen) {
    elem.requestFullscreen()
  } else if (elem.mozRequestFullScreen) { /* Firefox */
    elem.mozRequestFullScreen()
  } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
    elem.webkitRequestFullscreen()
  } else if (elem.msRequestFullscreen) { /* IE/Edge */
    elem.msRequestFullscreen()
  }
})
Run Code Online (Sandbox Code Playgroud)
<button id="toggle">
Toggle
</button>

<div id="fullscreen">
fullscreen content
</div>
Run Code Online (Sandbox Code Playgroud)

https://jsfiddle.net/svierkant/15buv80z/9/

在这种情况下,“用户手势”究竟是什么?如何通过单击事件切换全屏?

javascript google-chrome

6
推荐指数
1
解决办法
3645
查看次数

无法使用 Symfony HttpClient 检索错误消息

我使用 Symfony HttpClient 来调用外部 api。当 statusCode 为 200 时,我可以使用getContent()方法来检索 API 响应。如果 API 响应为 400,则抛出 ClientException 并且我无法获取外部 API 消息。

$httpClient = HttpClient::create();
$response = $httpClient->request($method, $url);
if (200 !== $response->getStatusCode()) {
    $apiResponse['statusCode'] = $response->getStatusCode();
    $httpInfo = $response->getInfo();
    $content = $response->getContent(); //this throws ClientException
}
Run Code Online (Sandbox Code Playgroud)

symfony symfony-http-client

6
推荐指数
1
解决办法
1482
查看次数

如何使用 symfony/panther 设置代理服务器

我发现有两种设置代理服务器的方法,一种是通过 chrome web 驱动程序功能,另一种是在创建 chrome 客户端时直接设置

$this->client = Client::createChromeClient(null, [
            '--proxy-server=socks://196.14.52.63:35048',
            '--headless',
            "--disable-gpu",
]);
Run Code Online (Sandbox Code Playgroud)

但在设置代理 IP 和端口后,我收到以下错误:

Curl error thrown for http POST to /session/cce06908d68a1e96bc6d1cb3b798aa14/url with params: {"url":"https:\/\/some-site\/login"}\n
Operation timed out after 30001 milliseconds with 0 bytes received
Run Code Online (Sandbox Code Playgroud)

基本上我想在使用Symfony panther抓取数据时使用代理服务器。

php proxy web-scraping symfony-panther

6
推荐指数
1
解决办法
979
查看次数