PHP初探感想

Jun 23, 2016 pm 02:32 PM

  仔细想来,我学php有整整一年半的时间了,而我接触网页设计才仅仅有2年时间,虽然时间很短,所学的东西仍非常有限,不能和各位网络大师相比,然每个人都有不同的学习方法和感悟,写出来供各位指点评论,也未必不是件好事
    也就是在2年前,我才开始学最基本的html标记,因为朋友要做个站,所以就下载了当时比较有名的动网asp论坛来搞,那时候也只是在论坛里找些代码尝试着粘贴到合适的地方。说到这里,还有一件非常搞笑的事情,当时搞不懂表单action的post和get方式的不同,所以根据字面意思我就理解为前者是向服务器发送数据,而后者是从服务器向客户端发送数据,而且还误人子弟,现在想来,真是有点愧疚,所以我对自己说:有不明白的地方就不要很确切的给别人说。通过这种方式以及在网上找资料学习,大约半年,经过自己的一点一滴的积累,终于写好了我的第1个asp网站。真的,刚开始学的时候确实有很多怀念的东西,因为什么东西都不会,也没有人来指点,所以只能在网上找资料,这也养成了我自学以及喜欢搜索的好习惯,印象最深的有一件事情,是朋友叫我写一个图片幻灯片,当时找了整整一个晚上,还算不错,找到了豪赌版本,有js的,flash的,vbscript的,最后选择了flash的,因为不需要改代码,只需要添加链接就可以了,但是当时朋友要求我一个页面要放好几个幻灯片,我就复制了一个幻灯片的代码然后粘贴,最后发现好像是错乱了,乱套了,后来查明原因是变量重复了,当时因为时间紧就没有自己重新写代码,于是我想到了另一个办法,每一个幻灯片作为一个框架,哎呀,这下问题解决了,不过就是选择整个幻灯片的时候位置出现了上下左右的浮动(我喜欢做好以后随便选择什么来随便点点或移动鼠标),反正是功能是实现了,总算在天亮之前可以睡个安稳觉了。
    去年暑假那个朋友看到很多网站都采用php,所以就老在我面前说改版,哎呀,我可头疼了,没学过啊。他说没事一边学一边做,于是我就在网上开始找资料,当然了:
    1.我要知道php是如何把内容发送到浏览器上的,经过查找,知道了通过echo这个函数来实现,后来逐渐发现有很多非常有用的函数如 sprintf blush ob_start等等函数,能达到很多特殊的效果。
    2.连接数据库,稍微知道web开发的人都知道php+mysql+apache的组合,所以选择mysql数据库就是我的首选了。我喜欢学一门语言首先找这个语言中的经典代码或程序,也忘了当时怎么找到discuz的,一下子就喜欢起来了,用的php连接数据库的类一直是它的,希望大家也喜欢,我也没有具体研究过用php本身自带的函数去连接数据库,有时间了测试下,呵呵 。
    3.asp的代码和html的代码是在一个文件中的,我当时就觉得非常不习惯,特别是当初只知道table tr td等等,不知道什么div css w3c,而且我编码喜欢缩进,自己看着喜欢,层次多了感觉非常不好,所以就在网上找相关资料,终于发现了一个php很有前途的东西:模板。一知道这个词,就在baidu里搜,哇,好多,最后我选择了smarty,原因是功能强大而且php官方本身就用的smarty。不过后来觉得这个东西比较麻烦,太大,而且对js代码需要加个代码才能实现,这个当时让我苦恼了好久,就是不知道测试正确的js如何运行不了。慢慢开始讨厌了,当然,discuz是我最喜欢的,所以我开始研究他的模板技术,哈哈,太高兴了,正合我意,一直用到现在。
    4.php+aphce+mysql的编码问题,这个问题开始的时候最让我苦恼了,我最先发现这个问题是以前asp的数据库导入到mysql里以后出现了乱码,还有后来接触到了ajax的protype框架,用gbk或gb2312是根本不能用的,在这里我只能提些意见,具体的操作就看各位的造化了,我建议所以编码采用utf-8码。
    5.w3c:这个东西是因为我讨厌table操作的麻烦而学习的,div+css+xml是我非常喜欢的,我希望大家也逐渐抛弃table吧,对了还有和js的结合,所以他们都要学好 。
    6.静态页面:根据我现在的理解,静态页面有两种,一种是伪静态页面,一种是实际存在的静态页面文件。我刚开始最后者不感冒,因为用apache的.htaccess文件就可以配置出相当灵活的伪静态页面,但是目前的情况,结合seo的发展趋势,后者是要着手研究了 。
    7.其他特殊的功能:比如大文件上传,单纯通过php是不能显示文件上传进度的,那么就涉及到和其他元素的结合,比如ajax,比如acticex,比如perl,比如applet,这些方法我都试过,虽然取得了比较有效的成绩,但是仍是我心头的一块石头。

今天先写到这里吧。呵呵

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
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)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1272
29
C# Tutorial
1252
24
Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Apr 17, 2025 am 12:06 AM

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values ​​to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

How does PHP type hinting work, including scalar types, return types, union types, and nullable types? How does PHP type hinting work, including scalar types, return types, union types, and nullable types? Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP vs. Other Languages: A Comparison PHP vs. Other Languages: A Comparison Apr 13, 2025 am 12:19 AM

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

See all articles