Backend Development
PHP Tutorial
PHP Job Search Guide Series - PHP Web Programming, Job Search Guide web_PHP Tutorial
PHP Job Search Guide Series - PHP Web Programming, Job Search Guide web_PHP Tutorial
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:
, 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: 4. How to solve the double margin problem of the following code under IE6? 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 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? JavaScript 1. Function to pop up the dialog box and get input focus function: Use the alert() function 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 页面代码如下: in.php 页面代码如下: 2. 编写代码,使得在文本框中输入一个年份,判断其生肖,并在文本框旁边输出,要求写出HTML和JavaScript代码: 前台页面设计的代码如下: 后台判断生肖的PHP脚本: 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树中创建并插入元素? 4.如何在DOM树中替换指定元素? 5.将一张图片以淡出的效果消失在页面中: 6.制作一个按钮,当按钮被单击时以卷帘效果消失: 7.照片轮换效果: 鉴于最近要准备各种期末考和大作业,发博时间明显减少,劳烦多多理解啊!本篇都是利用零碎时间编辑的,现在大功告成还是挺满足啦,若您觉得有帮助,可以随手点个赞。
属性名称
解析
border
定义边框的属性可以设置边框的宽度、颜色、样式
background-color
设置背景颜色
background-image
设置背景图像
font-size
设置字体大小
font-family
设置字体
text-decoration
检索或设置对象中文本的装饰,如下划线、闪烁等
line-height
检索或设置对象的行高,即字体最底端与字体内部顶端之间的距离
letter-spacing
检索或设置对象中的文字之间的间隔
text-align
设置或检索对象中文本的对齐方式
<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>
<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>
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><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> ?>
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
<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> }
<span>1</span> <script type="text/javascript"></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><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><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><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><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>
Hot AI Tools
Undresser.AI Undress
AI-powered app for creating realistic nude photos
AI Clothes Remover
Online AI tool for removing clothes from photos.
Undress AI Tool
Undress images for free
Clothoff.io
AI clothes remover
AI Hentai Generator
Generate AI Hentai for free.
Hot Article
Hot Tools
Notepad++7.3.1
Easy-to-use and free code editor
SublimeText3 Chinese version
Chinese version, very easy to use
Zend Studio 13.0.1
Powerful PHP integrated development environment
Dreamweaver CS6
Visual web development tools
SublimeText3 Mac version
God-level code editing software (SublimeText3)
Hot Topics
1378
52
Alipay PHP SDK transfer error: How to solve the problem of 'Cannot declare class SignData'?
Apr 01, 2025 am 07:21 AM
Alipay PHP...
Explain JSON Web Tokens (JWT) and their use case in PHP APIs.
Apr 05, 2025 am 12:04 AM
JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,
Explain the concept of late static binding in PHP.
Mar 21, 2025 pm 01:33 PM
Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo
Framework Security Features: Protecting against vulnerabilities.
Mar 28, 2025 pm 05:11 PM
Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.
How to send a POST request containing JSON data using PHP's cURL library?
Apr 01, 2025 pm 03:12 PM
Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...
Customizing/Extending Frameworks: How to add custom functionality.
Mar 28, 2025 pm 05:12 PM
The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.
Describe the SOLID principles and how they apply to PHP development.
Apr 03, 2025 am 12:04 AM
The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.
How does session hijacking work and how can you mitigate it in PHP?
Apr 06, 2025 am 12:02 AM
Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.


