Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 好久没来,发点感慨。

好久没来,发点感慨。

Jun 23, 2016 pm 01:16 PM

也算是CSDN的老人了……当年还当过BCB的版主,06/07年的时候转向PHP做一些自己的东西。

现在主力维护的站点是https://rsywx.net。用到的基本技术是LAMP,在海外搞了个虚拟主机。其它的技术包括:Symfony, Twig, Bootstrap。还有一段时间玩过Dart。

这几天比较空,上来转转,发现还是很很多年前一样, 重复的错误和重复的问题。

最大的问题还是: 陈旧的用法和库的使用

很多问题中列出的代码还是所谓的vanilla PHP:PHP代码和HTML代码交错地混合在一起。我只想说,这种做法是很不好的。现在,除了纯粹的测试一个函数或者一个库,而且你确定你的这些代码不会用到后续的产品中间,我才会用这样的vanilla PHP写法。否则,我一定会用一个框架(复杂一点的用Symfony,简单一点的用Silex)。

如果实在不想用框架,那么至少在调用数据库的时候,请你不要再用mysql_connect和类似的函数了,好吗?PHP已经明确表示这些函数(库)已经的过时,马上就会被停用。我们至少要用PDO吧?

还有,如果方便和有精力,可以考虑用composer来组织文件依赖关系吗?——这点我也做得不是很好,不过会慢慢提高。主要是因为我用框架时,框架将这些都自动包含了,自己在编写自己的应用时,就懒得应用了。

再多说几句。

要当一个好的PHP程序员,英语水平还是要有一定的高度。国内的文档以讹传讹的过多,而且传达的都是一些陈旧的信息(比如上面提到的陈旧的用法和陈旧的库的使用),对初入门的开发者影响太坏。所以跑到国外的技术站点去看那些最新的技术潮流,即使不能完全弄懂,也是能帮助我们提升眼界。眼界提高了,对自己的要求也就提高了。

我说这些没有别的意思,作为一个业余PHP开发者,我在Sitepoint.com上也发表过不少文章,都会讲述一些最新的技术,也学到很多新的工具的使用——比如我最近用Sami在生成API文档,用Spress在做一个静态站点。这些的讨论,我在这里没有看到,非常遗憾。

我没有贬低深入PHP最基本部分的重要性。一个Symfony的Request对象,最终还是要用到get/post过来的数据,但是,如果我们能通过浏览这些成熟框架的代码,直到它如何处理这些要求,对我们写自己的代码会有巨大的帮助。是不是?








回复讨论(解决方案)

学习了,很多程序员并没有在如何提高自己水平上面下足功夫!

不愧是大牛,搞得我一点不懂

666  接分模式开启

国内的文档以讹传讹的过多

这个的确是这样的。

LZ真是好久不见了

如果都按一个套路来,编程还有什么意思?

如果都按一个套路来,编程还有什么意思?



难道按照不好的、陈旧的套路才有意思?

重复的错误和重复的问题
初学者都会犯同样的错误,这一点都不奇怪

陈旧的用法和库的使用
现在并没有以新角度给初学者阅读的资料

框架会束缚使用者的思维,只有放弃思维定式,才可能有所创新

虽然目前现状并不乐观,但我依然坚持点滴的将他们引向正路,而你只是偶尔地来这指手画脚指责一下

斑竹说的好,精辟!

重复的错误和重复的问题
初学者都会犯同样的错误,这一点都不奇怪

陈旧的用法和库的使用
现在并没有以新角度给初学者阅读的资料

框架会束缚使用者的思维,只有放弃思维定式,才可能有所创新

虽然目前现状并不乐观,但我依然坚持点滴的将他们引向正路,而你只是偶尔地来这指手画脚指责一下



版主辛苦了

重复的错误和重复的问题
初学者都会犯同样的错误,这一点都不奇怪

陈旧的用法和库的使用
现在并没有以新角度给初学者阅读的资料

框架会束缚使用者的思维,只有放弃思维定式,才可能有所创新

虽然目前现状并不乐观,但我依然坚持点滴的将他们引向正路,而你只是偶尔地来这指手画脚指责一下



框架是束缚还是规范并加速提高,我认为是后者。

我偶尔来,当然有自己的原因。这个轮不到你来指摘。至少我也在认真的回答问题,用比较好的思路去回答问题。这样做是不对的?还是和你的想法不一样?
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 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
1655
14
PHP Tutorial
1252
29
C# Tutorial
1226
24
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,

How does session hijacking work and how can you mitigate it in PHP? 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.

What is REST API design principles? What is REST API design principles? Apr 04, 2025 am 12:01 AM

RESTAPI design principles include resource definition, URI design, HTTP method usage, status code usage, version control, and HATEOAS. 1. Resources should be represented by nouns and maintained at a hierarchy. 2. HTTP methods should conform to their semantics, such as GET is used to obtain resources. 3. The status code should be used correctly, such as 404 means that the resource does not exist. 4. Version control can be implemented through URI or header. 5. HATEOAS boots client operations through links in response.

How do you handle exceptions effectively in PHP (try, catch, finally, throw)? How do you handle exceptions effectively in PHP (try, catch, finally, throw)? Apr 05, 2025 am 12:03 AM

In PHP, exception handling is achieved through the try, catch, finally, and throw keywords. 1) The try block surrounds the code that may throw exceptions; 2) The catch block handles exceptions; 3) Finally block ensures that the code is always executed; 4) throw is used to manually throw exceptions. These mechanisms help improve the robustness and maintainability of your code.

What are anonymous classes in PHP and when might you use them? What are anonymous classes in PHP and when might you use them? Apr 04, 2025 am 12:02 AM

The main function of anonymous classes in PHP is to create one-time objects. 1. Anonymous classes allow classes without names to be directly defined in the code, which is suitable for temporary requirements. 2. They can inherit classes or implement interfaces to increase flexibility. 3. Pay attention to performance and code readability when using it, and avoid repeatedly defining the same anonymous classes.

What is the difference between include, require, include_once, require_once? What is the difference between include, require, include_once, require_once? Apr 05, 2025 am 12:07 AM

In PHP, the difference between include, require, include_once, require_once is: 1) include generates a warning and continues to execute, 2) require generates a fatal error and stops execution, 3) include_once and require_once prevent repeated inclusions. The choice of these functions depends on the importance of the file and whether it is necessary to prevent duplicate inclusion. Rational use can improve the readability and maintainability of the code.

Explain different error types in PHP (Notice, Warning, Fatal Error, Parse Error). Explain different error types in PHP (Notice, Warning, Fatal Error, Parse Error). Apr 08, 2025 am 12:03 AM

There are four main error types in PHP: 1.Notice: the slightest, will not interrupt the program, such as accessing undefined variables; 2. Warning: serious than Notice, will not terminate the program, such as containing no files; 3. FatalError: the most serious, will terminate the program, such as calling no function; 4. ParseError: syntax error, will prevent the program from being executed, such as forgetting to add the end tag.

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.

See all articles