Home Backend Development PHP Tutorial php学习第一天-勤劳致富

php学习第一天-勤劳致富

Jun 23, 2016 pm 01:20 PM

所谓“勤劳致富”,是很有科学依据的,且是经过我的亲身实践的。

自毕设突然转变为开发项目之后,整个天都变了。先是妹子给我订的票被强行取消,然后又是师兄的一句“***一小时就搞定了”,说明一下这个***是我毕设劳动量的1/2,我只能底下默默感慨原来毕设水这么深,显然这个结论是在我一天学习后才得出的。

废话就屏蔽到这吧。由于我是web的小白,先学习了html语言,花了两小时。是在 http://www.w3school.com.cn/index.html 上学习的,对这个网站大赞。在自学了html后,师兄给了第一个任务--搭环境(PhpStorm+WAMP+Git)。当然还有其他一些,比如让我熟悉git操作了,分清web术语了什么的小白才做的事情。phpstorm是个IDE,编码php很是在行。WAMP是一个集成开发环境,即windows+apache+mysql+php。而git是个分布式管理工具。配环境不难,这里感激下师兄让我配的不是LAMP。其中安装WAMP时,安装运行环境时出现个错误,说是一个dll不存在。对于这种运行库问题,我采取的是把一些常用的微软运行库合集一次性都安装了,就解决了。因为系统是昨晚才重装的,装的win10,至于原因嘛,只能说我抽了,大晚上一点去装系统。。。

环境装好后,师兄给了第二个任务---搭建以及部署服务器。听起来高大上,真正做的时候发现就是很简单的几小步。服务器就直接理解为WAMP下www目录吧。

只需要把地址指向127.0.0.0即我们的localhost就可以了。我们以后写的php等都会在这个页面呈现。

而部署略为麻烦。

所谓部署,也就是建立IDE、服务器和浏览器的映射。服务器和浏览器在上一步已映射好了,就是localhost。而我们现在需要把IDE的当前项目目录与WAMP的www目录建立映射。

而后:

映射完成。

于此,运行就可看到localhost显示的友好界面。

我使用的是thinkphp框架,它怎么用我一开始就直接搞错了,幸好师兄给我演示了下,感谢!因为IDE要套用thinkphp的架构,故而把thinkphp的包里的内容拷贝到IDE的工程目录下,就可在IDE中对其进行操作。

任务完成。现在看起来简单地要命,而前面操作的时候,各种百度查资料,干瞪着界面发愣。。。

师兄给的第三个任务是修改localhost界面以及链接并操作数据库。这是我的毕设内容一部分,师兄来句一小时,我还是花一晚上搞吧,现在数据库还没搞,我打算先把php基础语法掌握一下,至少得敲两下顺下手吧。

我注意到,localhost界面内容由入口文件index.php控制,其内容不多,表示两个点,一个是界面内容都在ThinkPHP/ThinkPHP.php里,界面结构在我查找后发现是在controller下的php文件里。我对其进行简单修改,便直接改变了localhost界面。

另外我发现一个问题。我想学习php语法,发现w3school上给我html平台可以进行编程展示效果,而php只能看范例,不能随心编程直接看到解释之后的效果。我一时一筹莫展。不过后面想到了IDE。我把入口文件index.php里导引文件ThinkPHP/ThinkPHP.php改成了我自己另外写的一个php文件,然后我在该php里写的内容可直接运行呈现在localhost上面。简单不难再赞。(也就我这么笨了,或者大家都知道这个办法,我自己却不知道,连phpstorm都不会用,也不敢问师兄,他挺忙的。)

最后总结一句:今天很美好!

对了,开题时所说的勤劳致富,是:丫的,一天瞪着电脑,白花花的屏幕闪瞎了我的*眼,晚上才想起,我可以去改背景色啊。。。我想骂人了,现在才想到,我可怜的眼睛。。。 该背景色的方法:File ~ Settings ~ Appearance & Behavior ~ Appearance ~ Theme 改成 Darcula即成黑色背景。

噢了。

最后留下一段php代码来结尾吧:

<?php$cars=array("Volvo","BMW","Toyota");$arrlength=count($cars);for($x=0;$x<$arrlength;$x++){    echo $cars[$x];    echo "<br>";}?>
Copy after login

效果:

Volvo

BMW

Toyota

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 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 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-

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

Framework Security Features: Protecting against vulnerabilities. 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.

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. 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,

See all articles