PHP Job Search Guide Series - PHP Web Programming, Job Search Guide web_PHP Tutorial

WBOY
Release: 2016-07-13 09:49:32
Original
1107 people have browsed it

PHP Job Search Guide Series - PHP Web Programming, Job Search Guide web

 PHP Web Programming

 form form

 1. Briefly describe what is the maximum capacity of POST and GET transmission?


  • The form data submitted by the GET method is appended to the URL and sent to the server as part of the URL. URL length should be limited to 1MB characters.
  • The POST method does not rely on the URL and does not display the passed parameter value in the address bar. In addition, the POST method can transfer data to the server without any restrictions. All submitted information is transmitted in the background and cannot be seen by the user on the browser side, so security is high.

2. How to control the size of uploaded files through the form?

  • enctype="multipart/form-data", specifies the way to encode data in the form.
  • method="post", specifies the data transmission method.
  • ,Controlled by hidden domain The size of the uploaded file (unit is bytes), this value cannot exceed the value set by the php.ini configuration file upload_max_filesize option.

 3. How to set the read-only attribute in the form?

  • Use readonly to set the read-only attribute of the specified content;
  • Use disabled to set the read-only attribute of the specified content.

  4. Under what circumstances can $name and $_POST['name'] be used interchangeably?

 When register_globals = On in the php.ini file, Both $name and $_POST['name'] can obtain the form elements in the form form The value of name (submitted in post mode).

However, it is not recommended to enable all register_globals variables, because it will bring security risks to the program.


 CSS style

 1.What is the meaning of CSS?

 CSS (Cascading Style Sheet, translated as "Cascading Style Sheet" or "cascading style sheet") language is a markup language that does not require interpretation and can be directly interpreted and executed by the browser (it belongs to the browser interpreted language) to control the appearance of the Web page. It is a set of extended style standards specified by the W3C Association to make up for the shortcomings of HTML in setting display attributes.

Its functions are as follows:

  • In standard web design, CSS is responsible for the performance of web content (XHTML).
  • The CSS file can also be said to be a text file, which contains some CSS tags. The CSS file must use the .css suffix.
  • Separating content and presentation through CSS files can change the overall presentation of the web page, making it easier to maintain the appearance of the site, making the HTML document code more concise and shortened Browser loading time.

 2. How many ways to insert CSS styles into HTML pages?

  • Define a pair of tags under the tag in the HTML page , use the tag name, class selector, and id selector to set attributes inside the tag.
  • Define the style attribute inside the tag, and then define the style under this tag, such as:
Create. css style file

, use id selectors or class selectors to define the style inside the file, and then use the tag to introduce the file in the displayed HTNL main page . Such as:  

 3. CSS style common attributes:

CSS样式的常用属性
属性名称 解析
border 定义边框的属性可以设置边框的宽度、颜色、样式
background-color 设置背景颜色
background-image 设置背景图像
font-size 设置字体大小
font-family 设置字体
text-decoration 检索或设置对象中文本的装饰,如下划线、闪烁等
line-height 检索或设置对象的行高,即字体最底端与字体内部顶端之间的距离
letter-spacing 检索或设置对象中的文字之间的间隔
text-align 设置或检索对象中文本的对齐方式

 

 

 4. How to solve the double margin problem of the following code under IE6?

<span><span><style type="text/css">
body </span>{<span>margin</span>:<span>0</span>;}<span>
div  </span>{<span>float</span>:<span>left</span>;  <span>margin-left</span>:<span>10px</span>;<span>    width</span>:<span>200px</span>;<span>    height</span>:<span>200px</span>;  <span>border</span>:<span>1px</span>;<span>    solid red;</span>}<span>
</style></span></span>
Copy after login

This is a common bug under IE6. Although the defined margin is 10px, IE parses it as 20px.

Solution: Add attribute display:inline

 5. How to solve the problem that the hover style does not appear after the hyperlink is clicked?

 Just sort the hyperlink style attributes correctly.

 a:link{color:red;text-docoration:none}

 a:visited{color:blue;text-decoration:none}

 a:hover{color:black;text-decoration:overline}

 a:action{color:black;text-decoration:overline}

 6. How to solve the problem that text cannot open the height of the container in Firefox browser?

 Add two CSS properties, min-width and min-height , which can also be added A div with clear alignment class clear:both attribute to automatically calculate the height in Firefox.

 7. How to define a container with a height of about 1px?

In the process of web page layout, a partition is often needed between the navigation bar and the content bar. Generally, setting a height of 1 pixel is optimal.


 DIV tag

 1. The difference between tags and

:

The

and tags also work in web page layout. The difference between them is:

  • The span tag is inline and is generally used to inline the styles of small modules into HTML documents
  • The div element itself is a block-level element, mostly used to combine large blocks of code

 2. How to center a DIV layer?

 position:absolute;

 top:50%;

  left:50%;

 margin:-100px 0 0 -100px;

 3. How to solve the problem of invalid text-align attribute of nested div tags in filefox browser?

<span>1</span> <span><style>
</span><span>2</span> <span>.one </span>{<span>border</span>:<span>1px solid blue</span>;<span>width</span>:<span>300px</span>;<span>height</span>:<span>200px</span>;<span>text-align</span>:<span>center </span>}
<span>3</span> <span>.two </span>{<span>border</span>:<span>1 px solid blue</span>;<span>width</span>:<span>200px</span>;<span>height</span>:<span>100px</span>;<span>margin</span>:<span>0px auto </span>}
<span>4</span> <span></style>
</span><span>5</span> <span><div class="one">
</span><span>6</span> <span><div class="two"></div>
</span><span>7</span> <span></div></span>
Copy after login

 JavaScript

 1. Function to pop up the dialog box and get input focus function:

Use the alert() function

to pop up a dialog box

To obtain the input focus, use the focus() function

  2. What is the redirection function in JavaScript? How to import an external JavaScript file?

Steering function: window.location.href="File name";

Introducing external JavaScript files:

 3. When the mouse passes over the text box, the content in the text box is automatically selected:

 

 4

 

 5. Set the JavaScript code of the homepage:

  设为首页


  Ajax 应用

  1.利用 jQuery中的Ajax判断用户名是否被占用:

  需要定义两个页面,index.php 页面代码如下:

 1 <script type="text/javascript" src="jquery-1.4.2.js"></script>
 2 <input type="text" ><input type="button" value="校验">
 3 <script type="text/javascript">
 4 $(<span>function</span><span>() {
 </span>5       $("input:last".click(<span>function</span><span>() {
 </span>6             $.get ("in.php",<span> {
 </span>7                     username:$("input:first").<span>val()
 </span>8             },<span>function</span><span>(data) {
 </span>9<span>                     alert (data);
 </span>10             })'<span>
 11        });
 12 });
 13 </script></span>
Copy after login

  in.php 页面代码如下:

<span> 1</span> <?<span>php
</span><span> 2</span> <span>$string</span>="明日科技"<span>;
</span><span> 3</span> <span>if</span>(<span>isset</span><span>($ GET[username])) {
</span><span> 4</span>     <span>if</span>(<span>urldecode</span>($ GET[username])==<span>$string</span><span>) {
</span><span> 5</span>             <span>echo</span> "用户名被占用"<span>;
</span><span> 6</span>     }<span>else</span><span>{
</span><span> 7</span>             <span>echo</span> "用户名可用"<span>;
</span><span> 8</span> <span>    }
</span><span> 9</span> <span>}
</span><span>10</span> ?>
Copy after login

 2. 编写代码,使得在文本框中输入一个年份,判断其生肖,并在文本框旁边输出,要求写出HTML和JavaScript代码:

  前台页面设计的代码如下:

PHP Job Search Guide Series - PHP Web Programming, Job Search Guide web_PHP Tutorial 1 <html> 2 <head> 3 <meta http-equiv="Content-type" content="text/html;charset="UTF-8""> 4 <script type="text/javascript" src="jequery-1.4.2.js">script> 5 <title>生肖的自动选择title> 6 head> 7 <body> 8 <input type="text" value="请输入年份格式为2015" onclick="this.select()"> 9 <input type="submit" value="判断"> 10 <span>span> 11 <script> 12 $(function(){ 13 $("input:last").click(function(){ 14 $.get("in.php",{ 15 number:$("input:first").val() 16 },function(data){ 17 $("span").text(data); 18 }); 19 }); 20 }); 21 script> 22 body> 23 html> View Code

  后台判断生肖的PHP脚本:

<span>1</span> <?<span>php
</span><span>2</span> <span>if</span>(<span>isset</span>(<span>$_GET</span>[<span>number</span><span>])){
</span><span>3</span>         <span>$array</span>=<span>array</span>("猪","鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗"<span>);
</span><span>4</span>         <span>foreach</span>(<span>$array</span> <span>as</span> <span>$key</span>=><span>$value</span><span>) {
</span><span>5</span>                 <span>if</span>(<span>ceil</span>(<span>$_GET</span>[<span>number</span>]%12)==<span>$key</span><span>){
</span><span>6</span>                         <span>echo</span> <span>$value</span><span>;
</span><span>7</span> <span>                 }
</span><span>8</span> <span>        }
</span><span>9</span> }
Copy after login

  jQuery框架

  目前比较流行的客户端脚本语言框架jQuery,由美国人John Resig创建,是优秀的JavaScript框架,其宗旨是write less,do more.它是轻量级的js库,兼容CSS3,兼容各种浏览器(IE 6.0+)。用户能更方便地处理HTML document、events,实现动画效果,并且可以方便地为网站提供AJAX交互。jQuery另一个比较大的优势是,它的文档说明很全,而且各种应用也说的很详细,同时还有许多成熟的插件可供选择。jQuery能够使用户的HTML页保持代码和HTML内容的分离,也就是说,不用再在HTML里面插入一堆js来调用命令了,只需定义id即可。

  1.jQuery中常用选择器:

  基本选择器:

  id选择器:只能用一次

  class选择器:允许重复使用

  标签选择器

  *:匹配所有元素

  层次选择器:

  $("#a.b") 选取id值为a的元素里所有class值为b的元素。

  $("#a>.b") 选取id值为a的元素后的class值为b的子元素。

  $("#a+.b") 选取id值为a的元素后紧挨的class值为b的元素。

  过滤选择器:

  :first,选取第一个元素。

  :odd,选取索引是奇数的元素。

  :even,选取索引是偶数的元素。

  :not,选取除某元素外的其他元素。

  :eq(),按索引寻找元素。

  :lt(),小于某索引值的元素。

  :gt,大于某索引值的元素。

  2.如何实现查找DOM树中的元素?

  var input = $("input:first");

  3.如何在DOM树中创建并插入元素?

<span>1</span> <script type="text/javascript" src="jquery-1.4.2.js"></script>
<span>2</span> <div>水果</div>
<span>3</span> <script>
<span>4</span> <span>var</span> title=$("<span>苹果</span>"<span>);
</span><span>5</span> $("div").append(title);<span>//</span><span>将title追加到div标签内容的后面</span>
<span>6</span> $("div").before(title);<span>//</span><span>将title追加到div标签之前与div标签属于同一层次</span>
<span>7</span> $("div").prepend(title);<span>//</span><span>将title追加到div标签内容之前</span>
<span>8</span> $("div").after(title);<span>//</span><span>将title追加到div标签之后与div标签属于同一层次</span>
<span>9</span> </script>
Copy after login

   4.如何在DOM树中替换指定元素?

<span>1</span> <script type="text/javascript" src="jquery-1.4.2.js"</script>
<span>2</span> <div>水果</div>
<span>3</span> <script>
<span>4</span> <span>var</span> title=$("<span>苹果</span>"<span>);
</span><span>5</span> $("div"<span>).replaceWith(title);
</span><span>6</span> </script>
Copy after login

  5.将一张图片以淡出的效果消失在页面中:

<span>1</span> <script type="text/javascript" src="jquery-1.4.2.js"></script>
<span>2</span> <img src="color.jpg">
<span>3</span> <script>
<span>4</span> $("img".click(<span>function</span><span>(){
</span><span>5</span>     $(<span>this</span>).fadeOut("slow"<span>);
</span><span>6</span> <span>});
</span><span>7</span> </script>
Copy after login

  6.制作一个按钮,当按钮被单击时以卷帘效果消失:

<span>1</span> <script type="text/javascript" src="jquery-1.4.2.js"></script>
<span>2</span> <input type="button" value="按钮">3</span> $("input").click(d=<span>function</span><span>(){
</span><span>4</span>         $(<span>this</span>).slideUp("slow"<span>);
</span><span>5</span> <span>});
</span><span>6</span> </script>
Copy after login

  7.照片轮换效果:

<span> 1</span> <script type="text/javascript" src="jquery-1.4.2.js"></script>
<span> 2</span> <style>
<span> 3</span> ul{list-<span>style:none;width:350px;height:200px;position:absolute}
</span><span> 4</span> <span>li{position:ansolute}
</span><span> 5</span> </style>
<span> 6</span> <div class="change">
<span> 7</span> <ul>
<span> 8</span> <li><img ssrc="1.jpg" width=350px height=200px></li>
<span> 9</span> <li><img ssrc="2.jpg" width=350px height=200px></li>
<span>10</span> <li><img ssrc="3.jpg" width=350px height=200px></li>
<span>11</span> <li><img ssrc="4.jpg" width=350px height=200px></li>
<span>12</span> </ul>
<span>13</span> </div>
<span>14</span> <script>
<span>15</span> $(<span>function</span><span>(){
</span><span>16</span>     $(."change ul li:not(:first)"<span>).hide();
</span><span>17</span>     setInterval(<span>function</span><span>(){
</span><span>18</span>         <span>if</span>($."change ul li:last").is(":visible"<span>)){
</span><span>19</span>             $(."change ul li:first").fadeIn("slow"<span>);
</span><span>20</span>             $(."change ul li:last"<span>).hide();
</span><span>21</span>     }<span>else</span><span>{
</span><span>22</span>             $(."change ul li:visible").next().fadeIn("slow"<span>);
</span><span>23</span> <span>    }
</span><span>24</span>   },1000<span>);
</span><span>25</span> <span>});
</span><span>26</span> </script>   
Copy after login

 

 

 


  鉴于最近要准备各种期末考和大作业,发博时间明显减少,劳烦多多理解啊!本篇都是利用零碎时间编辑的,现在大功告成还是挺满足啦,若您觉得有帮助,可以随手点个赞。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1019337.htmlTechArticlePHP求职宝典系列——PHP Web 编程篇,求职宝典web PHP Web 编程篇 form表单 1.简述 POST 和 GET 传输的最大容量分别是多少? GET 方法提交的表单数据...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template