对工作在与谷歌注册,使用PHP库V2,OAuth 2.0用户.
经过很长一段时间花在它上面我最终配置,它工作一次很好,但之后它没有工作.点击登录链接后,用户需要对Google进行身份验证.工作正常,直到认证完成.
在使用GET变量回调时:
?code=something&authuser=0&prompt=consent&session_state=something
Run Code Online (Sandbox Code Playgroud)
它产生以下错误:
致命错误:未捕获的异常"Google_AuthException",消息"在C:\ xampp\htdocs\test\google-api-php-client\src\auth\Google_OAuth2.php中收到OAuth2访问令牌错误消息:'invalid_client'':115堆栈跟踪:#0 C:\ xampp\htdocs\test\google-api-php-client\src\Google_Client.php(127):Google_OAuth2-> authenticate(Array,4/xUGSPbXR0LNzW ...')#1C:\xampp\htdocs\test\google-api-php-client\index.php(40):Google_Client-> authenticate('4/xUGSPbXR0LNzW ...')#2 {main}抛出C:\ xampp\htdocs \第115行的test\google-api-php-client\src\auth\Google_OAuth2.php
使用以下代码(它将帮助您理解):
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
require_once 'src/Google_Client.php';
require_once 'src/contrib/Google_PlusService.php';
session_start();
$client = new Google_Client();
$client->setApplicationName("Google+ PHP Starter Application");
$plus = new Google_PlusService($client);
if (isset($_REQUEST['logout'])) {
unset($_SESSION['access_token']);
}
if (isset($_GET['code'])) {
$client->authenticate($_GET['code']);
$_SESSION['access_token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
if (isset($_SESSION['access_token'])) {
$client->setAccessToken($_SESSION['access_token']);
}
if ($client->getAccessToken()) {
$me = $plus->people->get('me');
$url = filter_var($me['url'], FILTER_VALIDATE_URL);
$img = …Run Code Online (Sandbox Code Playgroud) 我做了一个新的Laravel项目:
composer create-project laravel/laravel testing_laravel
composer require laravel/dusk --dev
php artisan serve
php artisan dusk
Run Code Online (Sandbox Code Playgroud)
然后...
PHPUnit 6.3.1 by Sebastian Bergmann and contributors.
F 1 / 1 (100%)
Time: 1.12 seconds, Memory: 10.00MB
There was 1 failure:
1) Tests\Browser\ExampleTest::testBasicExample
Did not see expected text [Laravel] within element [body].
Failed asserting that false is true.
/Users/nobuhiroharada/work/laracast/testing_laravel/vendor/laravel/dusk/src/Concerns/MakesAssertions.php:274
/Users/nobuhiroharada/work/laracast/testing_laravel/vendor/laravel/dusk/src/Concerns/MakesAssertions.php:245
/Users/nobuhiroharada/work/laracast/testing_laravel/tests/Browser/ExampleTest.php:20
/Users/nobuhiroharada/work/laracast/testing_laravel/vendor/laravel/dusk/src/TestCase.php:92
/Users/nobuhiroharada/work/laracast/testing_laravel/tests/Browser/ExampleTest.php:21
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
Run Code Online (Sandbox Code Playgroud)
Chrome浏览器不是lauching.
我在localhost上使用macOS Sierra 10.12.1.
"laravel/framework": "5.5.*",
"laravel/dusk": "^2.0"
Run Code Online (Sandbox Code Playgroud)
非常感谢您的帮助.
我想在functions.phpWordPress中添加一个短代码,所以我可以在我的网站中使用我的功能.
问题是,显然shortcodes.php包括之后的functions.php,所以它给了我一个错误:
调用未定义的函数
add_shortcode
如何在我的脑中添加短代码functions.php?
我想.sql使用命令行将MySQL服务器中的文件导出到我的机器:
/Applications/MAMP/Library/bin/mysqldump -P 3306 -h server -u login -p passwd database > db_backup.sql
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
-bash:/ Applications/MAMP/Library/bin/mysqldump:没有这样的文件或目录
php ×3
google-api ×1
google-oauth ×1
laravel ×1
laravel-5 ×1
laravel-dusk ×1
macos ×1
mamp ×1
mysqldump ×1
oauth-2.0 ×1
terminal ×1
wordpress ×1