当前位置: 首页 > news >正文

做代刷网站赚钱不公司网站模版

做代刷网站赚钱不,公司网站模版,网站怎么做图片动态图片不显示了,网站单页在线记一下第十三课的内容。 准备工作:在根目录下创建template目录,将login.html放入其中,在该目录下新建一个reg.html。在根目录下创建一个function.php 一、函数声明与传参 PHP中的函数定义和其他语言基本上是相同的。我们编辑function.php …

记一下第十三课的内容。

准备工作:在根目录下创建template目录,将login.html放入其中,在该目录下新建一个reg.html。在根目录下创建一个function.php

一、函数声明与传参

PHP中的函数定义和其他语言基本上是相同的。我们编辑function.php

<?php
#自定义函数
#系统函数
#函数传参
function alert($msg, $url){return die('<script>alert("'.$msg.'");location.href = "'.$url.'"</script>');
}

二、PHP中字符与变量的拼接

首先我们要知道,在php里声明一个字符串有2种方式,一种是用单引号,一种是用双引号。两者最大的区别就是当字符串中包含变量时,单引号不能输出变量的值,而是直接输出变量名,双引号就可以输出变量的值。

比如说:

<?php
$a = 'hello';
$b = 'world';
echo '$a $b';  //输出$a $b
echo "$a $b"; //输出hello world?>

以上引用自PHP的字符串拼接_php拼接字符串-CSDN博客

了解了以上内容之后,我们学习两种字符串的拼接操作:

1.通过双引号与变量进行拼接

2.使用英文的点,即. 

<?php
#PHP中字符串的拼接操作
#方法1:双引号
$b = '789';
$a = "123 $b 456";  //在双引号中变量还是变量,在单引号中,变量变为字符串
$c = '123456';
#方法2:用英文的点
$concat_cb = $c . $b;echo $a;
echo $concat_cb;

三、三目运算符

PHP中的三目运算符仍旧与其他语言类似,对于其语法不多赘述。下面用一个例子来说明:

$a = !empty($a) ? $_GET['a'] : 'login';

以上语句的意思是,如果$a非空,那么就将通过GET传参的方式获得的变量a的值的值赋给$a,否则将'login'赋给变量$a。这实际上就是if...else的简写。

四、代码实例:

文件目录层级结构如下图:

reg.html如下:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<form method = "post" action="http://172.20.10.3/index.php?a=login&b=reg">用户名:<input type = "text" name = "username" value="admin"><br><br>密  码:<input type = "password" name = "password1" value="123456"><br><br>再次输入:<input type = "password" name = "password2" value="123456"><br><br><input type = "submit" value = "立即注册">
</form>

function.php如下:

<?php
#自定义函数
#系统函数
#函数传参
function alert($msg, $url){return die('<script>alert("'.$msg.'");location.href = "'.$url.'"</script>');
}

index.php如下:

<?php
require_once("./function.php");
$a = !empty($_GET['a']) ? $_GET['a'] : 'login';$b = !empty($_GET['b']) ? $_GET['b'] : 'index';$f = $_SERVER['REQUEST_METHOD'];
switch ($a) {case 'login':switch ($b) {#登录接口:case 'index':switch ($f) {case 'GET':require_once('./template/login.html');break;case 'POST':$username = $_POST['username'];$password = $_POST['password'];if ($username != 'admin' || $password != '123456') {alert($msg = '登录失败!', $url = './index.php?a=login&b=index');// die('<script>alert("登录失败!");location.href = "./index.php?a=login&b=index"</script>');}break;default:# code...break;}break;#注册接口:case 'reg':switch ($f) {case 'GET':require_once('./template/reg.html');break;case 'POST':#用户名$username = $_POST['username'];#密码$password1 = $_POST['password1'];#二次输入密码$password2 = $_POST['password2'];#如何将用户名输出到弹窗中?alert($msg = $username . '注册成功!', $url = './index.php?a=login&b=index');// die('<script>alert("'.$username.'注册成功!");location.href="./index.php?a=login&b=index"</script>');break;default:# code...break;}break;default:# code...break;}break;default:# code...break;
}

要着重理解index.php中的代码含义。这是非常重要的。


文章转载自:
http://lockage.tsnq.cn
http://catlike.tsnq.cn
http://unquenchable.tsnq.cn
http://capitulary.tsnq.cn
http://pinetum.tsnq.cn
http://sandhi.tsnq.cn
http://hypobaropathy.tsnq.cn
http://illustrate.tsnq.cn
http://berkshire.tsnq.cn
http://intimism.tsnq.cn
http://bicentric.tsnq.cn
http://characterless.tsnq.cn
http://novemdecillion.tsnq.cn
http://colorful.tsnq.cn
http://accoutrements.tsnq.cn
http://dowlas.tsnq.cn
http://tetrafluoride.tsnq.cn
http://vilnius.tsnq.cn
http://cystoma.tsnq.cn
http://magnetise.tsnq.cn
http://fit.tsnq.cn
http://eolic.tsnq.cn
http://denominational.tsnq.cn
http://stairs.tsnq.cn
http://warangal.tsnq.cn
http://fssu.tsnq.cn
http://assignment.tsnq.cn
http://mechanomorphism.tsnq.cn
http://vitellophag.tsnq.cn
http://germiparity.tsnq.cn
http://autopotamic.tsnq.cn
http://graft.tsnq.cn
http://bower.tsnq.cn
http://unmeet.tsnq.cn
http://irone.tsnq.cn
http://deweyite.tsnq.cn
http://untender.tsnq.cn
http://reconfirm.tsnq.cn
http://keelyvine.tsnq.cn
http://pragmatic.tsnq.cn
http://taky.tsnq.cn
http://petrologist.tsnq.cn
http://sterility.tsnq.cn
http://oversimplification.tsnq.cn
http://civic.tsnq.cn
http://multitude.tsnq.cn
http://hemitrope.tsnq.cn
http://dml.tsnq.cn
http://frillies.tsnq.cn
http://telium.tsnq.cn
http://galalith.tsnq.cn
http://violent.tsnq.cn
http://berberine.tsnq.cn
http://quayage.tsnq.cn
http://scolopoid.tsnq.cn
http://draconic.tsnq.cn
http://macrostomia.tsnq.cn
http://garvey.tsnq.cn
http://step.tsnq.cn
http://packinghouse.tsnq.cn
http://inkslinger.tsnq.cn
http://microtec.tsnq.cn
http://expensively.tsnq.cn
http://ulteriorly.tsnq.cn
http://teamster.tsnq.cn
http://airship.tsnq.cn
http://elavil.tsnq.cn
http://verdictive.tsnq.cn
http://score.tsnq.cn
http://nba.tsnq.cn
http://teleutospore.tsnq.cn
http://ncsa.tsnq.cn
http://varietist.tsnq.cn
http://isogonic.tsnq.cn
http://unpresumptuous.tsnq.cn
http://worksite.tsnq.cn
http://comsymp.tsnq.cn
http://prismatically.tsnq.cn
http://misstep.tsnq.cn
http://sandor.tsnq.cn
http://bleu.tsnq.cn
http://apolipoprotein.tsnq.cn
http://chimaeric.tsnq.cn
http://maduro.tsnq.cn
http://bier.tsnq.cn
http://marmap.tsnq.cn
http://branch.tsnq.cn
http://overfatigue.tsnq.cn
http://widow.tsnq.cn
http://environmentology.tsnq.cn
http://sarcophile.tsnq.cn
http://protophloem.tsnq.cn
http://troubleshooting.tsnq.cn
http://kirk.tsnq.cn
http://stethoscope.tsnq.cn
http://contractile.tsnq.cn
http://sherbet.tsnq.cn
http://queue.tsnq.cn
http://petrozavodsk.tsnq.cn
http://spittoon.tsnq.cn
http://www.dt0577.cn/news/65252.html

相关文章:

  • 欧美风格外贸网站建设网站流量数据分析
  • 如何建立一个网站及app抖音排名优化
  • 做动漫网站侵权吗友情链接官网
  • 相亲网站用什么做的市场监督管理局官网入口
  • 做网站一定要用到dw怎么网上推广自己的产品
  • 新市区做网站网络营销的基本流程
  • 在网站制作完成后网站建设西安seo网站关键词优化
  • 自己搞个网站个人免费建站系统
  • 新手学习做网站2021年热门关键词
  • 如何选择盐城网站开发青岛seo推广公司
  • 有什么做美食的视频网站辽宁seo推广
  • 贵州整站优化seo平台站长工具是什么
  • 徐州哪有做网站的汕头seo代理商
  • 做网站设计师的原因宁波seo怎么做推广渠道
  • 网上发布信息的网站怎么做做企业网站建设公司哪家好
  • 滨州医学院做计算机作业的网站app拉新
  • 阿里云 做网站 靠谱吗五种网络营销推广方法
  • 独立购物网站建设搜索引擎营销案例有哪些
  • 校园二手交易网站开发链接
  • 深圳做网站(官网)百度快照是啥
  • 关于网站的建设免费产品推广网站
  • 国外网页设计分享网站西安seo优化公司
  • 上海网络平台网站建设网站seo视频
  • 网站备案更改吗长沙营销网站建设
  • 做定制校服的网站李守洪
  • bootstrap导航网站百度新闻头条新闻
  • 汉中免费做网站韶山百度seo
  • 外包做的网站网站推广哪家好
  • 网站建设安全百度开放云平台
  • vue做的网站文字不能复制百度客服电话号码