我使用Laravel的护照包为我的rest api提供基于令牌的身份验证.现在,我正在使用个人访问令牌概念来生成访问令牌.
要为单个用户生成访问令牌,我使用下面的代码生成名为" android " 的令牌.
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
// Here the access token will be stored in $token variable.
$token = $user->createToken('android')->accessToken;
// Now the $token value would be something like
//eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImMyNjI3YzU0YjFhNWIxZTFlMTdkODhmZTk1NzhjNzAzY2QyMTU0MzhlOD...
Run Code Online (Sandbox Code Playgroud)
稍后我想在我的管理仪表板上显示个人访问令牌,我很难再次获得生成的令牌.尝试下面的代码,但无法获取访问令牌.
$user = User::find(1)
dd($user->tokens())
Run Code Online (Sandbox Code Playgroud)
我也尝试使用护照vue元素,但它只显示访问令牌名称,而不是实际令牌.
<passport-personal-access-tokens></passport-personal-access-tokens>
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.
谢谢
我在设置未捕获的异常处理程序时遇到了一些问题.这就是我在做的事情:
在app delegate.h中:
- (void) uncaughtExceptionHandler(NSException *exception);
Run Code Online (Sandbox Code Playgroud)
在app delegate.m中:
void uncaughtExceptionHandler(NSException *exception) {
[FlurryAPI logError:@"Uncaught" message:@"Crash!" exception:exception];
}
- (void)applicationDidFinishLaunching:(UIApplication *)application {
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler); // error line
[FlurryAPI startSession:@"API_KEY"];
....
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Use of Undeclared Identifier "uncaughtExceptionHandler"
Run Code Online (Sandbox Code Playgroud) 我正在使用PHP和MySQL构建一个图像厨房,我希望通过它的颜色实现图像搜索.通过跟随Imagick :: getImageHistogram,我从图像中获得了最多呈现的颜色.
<?php
$image = new Imagick("thing.png");
$pixels=$image->getImageHistogram();
foreach($pixels as $p){
$colors = $p->getColor();
foreach($colors as $c){
print( "$c\t" );
}
print( "\t:\t" . $p->getColorCount() . "\n" );
}
?>
This will print out something like:
Red Green Blue Alpha : No of times appeared
252 250 252 1 : 125
194 156 182 1 : 126
109 18 79 1 : 11440
2 117 162 1 : 12761
255 255 255 1 …Run Code Online (Sandbox Code Playgroud)