不用数据库php 不用数据库的网站程序

linux怎么快速安装nginx和php,不用安装数据库Linux下如果要搭建nginx和php环境,需要安装三个软件包:
nginx,php,php-fpm
比如说如果是centos的话:
yum install nginx php php-fpm
可能软件包名有差别,这个查查就知道了 。
然后配置nginx,修改nginx.conf,如果用sock就这样写 , 如果是端口就些端口:
location ~ \.php$ {
fastcgi_passunix:/var/run/php-fpm/php-fpm.sock;
fastcgi_indexindex.php;
includefastcgi.conf;
}
然后启动服务,以centos7为例:
systemctl start nginx
systemctl start php-fpm
我想用PHP写一个PHP登陆界面,不需要连接数据库的.将下面代码保存为login.php 和 confirm.php,然后运行login.php就可以
login.php
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ""
html
head
title New Document /title
meta http-equiv="content-type" content="text/html; charset=utf-8"
meta name="Generator" content="EditPlus"
meta name="Author" content=""
meta name="Keywords" content=""
meta name="Description" content=""
/head
body
form name="form1" method="post" action="confirm.php"
p用户名:input type="text" name="user"/p
p密码:input type="password" name="pwd"/p
pinput type="submit" name="b1"/p
/form
/body
/html
confirm.php
?
【不用数据库php 不用数据库的网站程序】echo 'meta http-equiv="content-type" content="text/html; charset=utf-8"';
$user = isset($_POST['user'])? $_POST['user'] : '';
$pwd = isset($_POST['pwd'])? $_POST['pwd'] : '';
if(empty($user) || empty($pwd)){
echo '用户名和密码不能为空';
exit();
}
if($user=='user'$pwd=='pwd'){
echo '登陆成功';
}else{
echo '用户名或密码错误';
}
?
php不用数据库设计登录界面有啊 。直接将账号密码POST 到另一个PHP 接受 。。
index.php
form name="form1" method="post" action="confirm.php"
p用户名:input type="text" name="user"/p
p密码:input type="password" name="pwd"/p
pinput type="submit" /p
/form
confirm.php
?php
$user = isset($_POST['user'])? $_POST['user'] : '';
$pwd = isset($_POST['pwd'])? $_POST['pwd'] : '';
if(empty($user) || empty($pwd)){
echo '用户名和密码不能为空';
exit();
}
if($user=='user'$pwd=='pwd'){
echo '登陆成功';
}else{
echo '用户名或密码错误';
}
?
php不使用数据库信息终究是要存储的不用数据库php,最终都需要存储在文件中 , 数据库在这个事情上可以让为是帮不用数据库php你管理一大堆的“文件”,其他的如csv、excel,也算是变相的一种数据库了;
如果非不要数据库,建议直接生成静态html吧,可以用markdown之类的工具 。修改不方便 。
关于不用数据库php和不用数据库的网站程序的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读