我使用$ _POST形式输入,代码如下所示
<form class="form-signin" method="POST" action="">
<div class="form-label-group">
<label for="username">User Name</label>
<input type="text" name="username" class="form-control" placeholder="username" required autofocus>
</div>
<div class="form-label-group">
<label for="password">Password</label>
<input type="password" name="password" class="form-control" placeholder="Password" required>
</div>
<button class="btn btn-primary mt-3" type="submit" name="SubmitLogin">Submit</button>
</form>
Run Code Online (Sandbox Code Playgroud)
这只是一个简单的用户名和密码,然后我使用此代码检查用户名和密码
if(isset($_POST["SubmitLogin"])){
$data = $_POST['SubmitLogin'];
var_dump($data);
$username = $data['username'];
$password = $data['password'];
$result = mysqli_query($mysqli, "SELECT COUNT(*) AS Exist FROM user WHERE username = '$username' AND pwd = '$password' ");
$login = mysqli_fetch_array($result);
if($login['Exist'] == 1){
$_SESSION["Login"] = true;
header('Location:index.php');
}else{
echo '<script …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 docker 中运行我的restful api,但是我的 golang 可执行文件有问题,它总是找不到。这是我的 Dockerfile
# Start from golang base image
FROM golang:1.15.2
#Set ENV
ENV DB_HOST=fullstack-mysql \
DB_DRIVER=mysql \
DB_USER=root \
DB_PASSWORD=root \
DB_NAME=link_aja \
DB_PORT=3306 \
APP_NAME=golang-linkaja \
CGO_ENABLED=0
# Copy the source from the current directory to the working Directory inside the container
COPY . /usr/src/${APP_NAME}
# Move to working directory
WORKDIR /usr/src/${APP_NAME}
#install depedencies
RUN go mod download
# Build the application
RUN go build -o ${APP_NAME}
# Expose port 3000 to the outside …Run Code Online (Sandbox Code Playgroud)