php基本入门

Jun 23, 2016 pm 02:31 PM

简介:这是php基本入门的详细页面,介绍了和php,php php基本入门有关的知识、技巧、经验,和一些php源码等。

class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=350526' scrolling='no'> 搭环境。
    如果你的项目名中有空格的话,你需要更改项目得名字,名字中不允许出现空格,否则,解析不到。
  (1)更改 apache下的conf文件夹下的httpd.conf文件中的端口,默认8080端口是被占用的、
  (2)点击项目下的.exe执行文件。然后再右下角会出现一个图标,左键点击图标,点击         全部启动。
  (3) 访问页面。http://localhost:8080/
1.若是想导入什么 php文件,或者写一些 php的代码(像增删改查的语句和echo等)的代码时,需要加上“
2.如果是前台部分,你就需要把header和footer抽出来,每个需要装饰的页面都导入这两个页面。
3.session_start()开始session。判断是否登录,同时,可以把你之前存入session中的东西拿出来。
4.从页面中取值使用$_POST.
5.声明变量使用$变量名、例如:$user.
6.输出――echo后面跟你要输出地数据。
  例如:
   (1)输出字符串:echo "字符串";
   (2)输出变量:echo $user;
   (3)输出alert:echo"<script>alert('$user')</script>";
   每个语句完成后,使用;号结束。
7.相关联的使用".",相当于java中的"+";例如:'".$user."'
8.target="_self"在当前页打开。不写默认。若是iframe嵌套的话,需要写你的iframe名字。
9.$db->query的意思:
    (1)$db显然是一个 数据库操作对象,一般情况下在include中的db_class文件下。
    (2)-> 表示调用或者所属关系(箭头左边是箭头右边的父项),相当于c里面的"."可以简单的理解为,左边为一个对象,右边则是这个对象的属性或方法。
     (3)query 数据库对象中的一个方法,用于执行MySql命令,并将执行的结果返回。
10.php中htmlspecialchars和htmlentities函数都能把html中的特殊字符转换成对应的character entity。但是,他们还是有区别的,区别1:当有中文时,最好用htmlspecialchars,否则可能会有乱码
       区别2:htmlentities有三个可选参数,分别是$quote_style、$charset、$double_encode
结论:htmlspecialchars和htmlentities函数的区别在于htmlspecialchars只会转化手册上列出的几个html character entity (也就是会影响html解析的那几个基本字符)而htmlentities会转化所有的。一般来说,使用htmlspecialchars转化掉基本字符就已经足够了,没有必要使用htmlentities函数,实在要用,就注意一下为第三个参数传递正确的编码

这只是一些基本的,是我学习中记下的,以备以后用到。未完待续、、、

爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

http://biancheng.dnbcw.info/php/350526.html pageNo:3
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

PHP Logging: Best Practices for PHP Log Analysis PHP Logging: Best Practices for PHP Log Analysis Mar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Explain the concept of late static binding in PHP. 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

Customizing/Extending Frameworks: How to add custom functionality. 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.

See all articles