我目前正在使用以下服务在spring boot中构建基于微服务的应用程序
当用户将其凭据发送到auth服务器时,auth服务器应验证它们是否正确,然后返回访问令牌.
我的问题是,我应该将auth服务器与用户服务结合起来,因此查找凭据是一个简单的数据库调用,还是应该将它们作为单独的应用程序保存,并让它们都指向同一个共享数据库?还有更好的选择吗?
当我点击一个按钮时,我试图将标签增加2.
import UIKit
class ViewController: UIViewController {
var cur = 0;
@IBOutlet weak var money: UILabel!
@IBAction func pressbutton(sender: UIButton) {
cur = money.text!.toInt()!;
self.money.text = String(cur + 2);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我当前的代码,但我收到错误
toInt()是不可用的:使用Int()初始值设定项
在这条线上
cur = money.text!.toInt()!;
Run Code Online (Sandbox Code Playgroud) 我试图在我的laravel网站上强制使用https和非www.这是我的.htaccess文件:
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
#if the request is not secure
RewriteCond %{HTTPS} off
#redirect to the secure version
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
#Redirect to non-WWW
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^(.*) https://example.com/$1 [QSA,L,R=301]
Run Code Online (Sandbox Code Playgroud)
以下是当前的重定向
工作重定向
example.com => https://example.com (GOOD)
www.example.com => https://example.com (GOOD)
https://www.example.com => https://example.com (GOOD)
Run Code Online (Sandbox Code Playgroud)
直接到正确的URL工作正常
https://example.com => https://example.com (GOOD)
https://example.com/asdf …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用正则表达式从字符串中删除所有不允许的字符。这是我当前的 php 代码
$input = "";
$pattern = "[a-zA-Z0-9_ !@#$%^&*();\\\/|<>\"'+\-.,:?=]";
$message = preg_replace($pattern,"",$input);
if (empty($message)) {
echo "The string is empty";
}
else {
echo $message;
}
Run Code Online (Sandbox Code Playgroud)
当我运行此程序时,当我希望它打印出“字符串为空”时,表情符号会被打印出来。
当我将正则表达式代码放入http://regexr.com/时,它显示表情符号不匹配,但是当我运行代码时,它会被打印出来。有什么建议么?