我想在 Twig 视图中查看 Symfony 3 中的当前路线。
我已经做了一些研究,但我没有找到任何解决方案。我在 Twig 视图中尝试以下操作:
{{ app.request.uri }}
Run Code Online (Sandbox Code Playgroud)
它返回如下内容: http://localhost:8000/_fragment?_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3DFOSUserBundle%253ASecurity%253Alogin
{{ app.request.get('_route') }}
Run Code Online (Sandbox Code Playgroud)
总是返回 NULL。
{{ app.request.getpathinfo }}
Run Code Online (Sandbox Code Playgroud)
一直有: /_fragment
我需要的很简单。对于像 的 URL localhost:8000/article/5,我想检索/article/5.How to do this?
我正在尝试在 node.js 上使用 google api,但总是出现以下错误:
invalid_grant
Malformed auth code
Run Code Online (Sandbox Code Playgroud)
通过在网络上搜索,我发现客户端 ID 应该是电子邮件地址,而不是控制台上的客户端 ID。我将其更改为我的 google 帐户的电子邮件地址,情况更糟,因为我无法使用 google 进行连接
这是改编自https://developers.google.com/youtube/v3/docs/videos/list的代码
var fs = require('fs');
var readline = require('readline');
var { google } = require('googleapis');
// var googleAuth = require('google-auth-library');
// If modifying these scopes, delete your previously saved credentials
// at ~/.credentials/google-apis-nodejs-quickstart.json
var SCOPES = ['https://www.googleapis.com/auth/youtube.force-ssl']
var TOKEN_DIR = (process.env.HOME || process.env.HOMEPATH ||
process.env.USERPROFILE) + '/.credentials/';
var TOKEN_PATH = TOKEN_DIR + 'google-apis-nodejs-quickstart.json';
// Load client secrets from a local file. …Run Code Online (Sandbox Code Playgroud)