php网站功能块学习

tech2022-09-06  100

php网站功能块学习

PHP 7, the next version of the world’s most popular programming language, has been released. We’d love to shoot fireworks and get drunk with our newfound power (seriously, the language is in the true big leagues now, functionality and performance-wise) but we’re sure the rest of the internet will do this for us. Instead, we’ll focus on compiling a (perpetually up to date) list of resources to get started with version 7 – posts describing what’s new, books helping you kick things off, and more. Let’s get to it!

PHP 7,世界上最流行的编程语言的下一个版本,已经发布。 我们很想射击烟花,并以我们新发现的力量为自己喝醉(说真的,这种语言已成为真正的大联盟,无论是功能还是性能方面 ),但是我们确信互联网的其余部分将为我们做到这一点。 取而代之的是,我们将专注于编译(永久更新)的资源列表以开始使用版本7 –描述新功能的帖子,可帮助您开始工作的书籍等等。 让我们开始吧!

PHP 6发生了什么? (What Happened to PHP 6?)

When told the next major version is 7 while we’ve been developing on 5+ so far, many wonder what happened to version 6. It’s a long story, so to avoid looking confused when this is brought up, here are some interesting discussions and posts as required reading:

当到目前为止,我们已经在5+上进行开发时,当告诉下一个主要版本是7时,很多人都想知道版本6发生了什么。这是一个很长的故事,因此,为避免混淆,在此进行了一些有趣的讨论,根据需要发布的文章:

https://philsturgeon.uk/php/2014/07/23/neverending-muppet-debate-of-php-6-v-php-7/

https://philsturgeon.uk/php/2014/07/23/neverending-muppet-debate-of-php-6-v-php-7/

https://wiki.php.net/rfc/php6

https://wiki.php.net/rfc/php6

https://news.ycombinator.com/item?id=8786919

https://news.ycombinator.com/item?id=8786919

In short, the unicode problems that were supposed to be solved in version 6 ultimately failed, with too many added complications, and this kind of ruined things for everyone. It was decided that version 6’s rep was too damaged to keep it alive, and a move to PHP 7 was made.

简而言之,原本应该在版本6中解决的unicode问题最终失败了,并增加了太多的复杂性,并且这种破坏了所有人的生活。 决定版本6的rep太损坏以致无法继续运行,因此转向了PHP 7。

新功能 (New Features)

We’ve spoken about the new features briefly before, but here’s a more comprehensive list of links to information about them – now’s the time to dive in and get ready.

之前 ,我们已经简要介绍了这些新功能,但是这里有更全面的链接,其中包含有关这些功能的信息-现在是您深入研究并做好准备的时候了。

To learn about what’s coming and what an impact it might have on you:

要了解即将发生的事情及其对您的影响,请执行以下操作:

Official list of new features

官方新功能列表

Super comprehensive list on Github

Github上的超级综合列表

What to Expect series

期待什么系列

PHP7 at a glance

PHP7概览

DigitalOcean’s look at new features

DigitalOcean看新功能

Colin O’dell’s 5 Lesser Known Features, just one in a set of several very useful PHP 7 posts of his

Colin O'dell的5个鲜为人知的功能 ,仅是他的几篇非常有用的PHP 7帖子集中的一个

If you’re into video lessons and don’t mind paying for them, two sites covered basically the same thing:

如果您正在学习视频课程而又不介意付费,那么两个站点基本上都包含相同的内容:

Codecourse at https://www.codecourse.com/library/lessons/php-7-new-features

https://www.codecourse.com/library/lessons/php-7-new-features上的代码课程

Laracasts at https://laracasts.com/series/php7-up-and-running

网址为https://laracasts.com/series/php7-up-and-running的 Laracasts

To learn about the type system, arguably the biggest change, and how it compares to hack:

要了解类型系统(可以说是最大的变化)以及它与hack的比较方式:

http://www.dmiller.io/blog/2015/4/26/comparing-the-php7-and-hack-type-systems

http://www.dmiller.io/blog/2015/4/26/comparing-the-php7-and-hack-type-systems

https://medium.com/the-white-hat-elephpant/php7-more-strict-but-only-if-you-want-it-to-be-78d6690f2090

https://medium.com/the-white-hat-elephpant/php7-more-strict-but-only-if-you-want-it-to-be-78d6690f2090

PHP 7入门 (Getting Started with PHP 7)

If you’re not of the VM sort, to install PHP 7 on the most recent version of OS X, see http://php-osx.liip.ch/

如果您不属于VM,则要在最新版本的OS X上安装PHP 7,请参见http://php-osx.liip.ch/

If you are, however, there’s Jump Start PHP Environment – a book by yours truly, edited and reviewed by the venerable Ross Tuck. It’s a short book on getting started before code – learning about requests, responses, virtual machines, and all the other important server and local development machine setups. The book helps prepare you to write platform-agnostic code, and makes it possible for others to just jump into your team at a whim.

但是,如果您是,请参阅Jump Start PHP Environment ,这是由您本人真正撰写,由古老的Ross Tuck编辑和审查的书。 这是一本关于在代码之前入门的简短书–了解请求,响应,虚拟机以及所有其他重要的服务器和本地开发计算机设置。 这本书有助于您准备编写与平台无关的代码,并使其他人可以随心所欲地跳入您的团队。

Paid intro course from Zend – good for people familiar with PHP 5 who don’t mind shelling out some cash

Zend的付费入门课程 –对熟悉PHP 5且不介意花一些钱的人来说非常有用

Official migration guide from 5.x

从5.x开始的官方迁移指南

Erika’s excellent post on DigitalOcean

Erika在DigitalOcean上的精彩文章

Various compatibility checkers and converters are available:

提供各种兼容性检查器和转换器:

PHP7MAR (Migration Assistant Report) will report any inconsistencies between your current code base and PHP 7, so you can plan and budget your upgrade path

PHP7MAR (迁移助手报告)将报告当前代码库和PHP 7之间的任何不一致之处,因此您可以计划和预算升级路径

php7ize is a code fixer that tries to add PHP 7 features into a PHP 5 codebase automatically

php7ize是一个代码修复程序,试图将PHP 7功能自动添加到PHP 5代码库中

php7cc (Compatibility Checker) will try and do the same things as the MAR above – compare their outputs for the most reliable results.

php7cc (兼容性检查器)将尝试与上述MAR进行相同的操作-比较其输出以获得最可靠的结果。

It should be noted that none of the tools above are a replacement for a good test suite – the only way to be 100% certain there’s no bugs left behind is to cover your code with tests so it can be easily inspected and verified during migration.

应该注意的是,以上工具都不是好的测试套件的替代品–唯一可以百分百确定没有遗留任何错误的方法是用测试覆盖代码,以便在迁移过程中轻松检查和验证代码。

Last but not least, PHPToday have put together an absolutely fantastic list of talks which you can take a look at here.

最后但并非最不重要的一点是,PHPToday汇集了绝对精彩的演讲清单,您可以在此处查看 。

工具,测试和托管 (Tools, testing and hosting)

Lots of helpful tools have already sprung up around the new release:

新版本中涌现出许多有用的工具:

PhpStorm, ahead of the pack as ever, already comes with full PHP 7 mode.

PhpStorm ,比以往任何时候都领先,已经带有完整PHP 7模式。

Phan is a static analyzer, the features of which you’d best read about here. We’ve got a full tutorial coming up, for the curious.

Phan是静态分析仪,您最好在这里阅读其功能。 出于好奇,我们准备了完整的教程。

Exakat is another analyzer

Exakat是另一种分析仪

Tuli is yet another – but development is somewhat halted. If anyone wants to write a comparison post targeting all three, let us know!

图里(Tuli )又是另一个-但发展有些停滞。 如果有人想针对这三个方面撰写比较文章,请告诉我们!

Andrea Faulds threw out some interesting PHP 7 exclusive packages that warrant a look!

Andrea Faulds抛出了一些有趣的PHP 7独家软件包 ,值得一看!

A Vagrant box by Rasmus Lerdorf is the box to use when testing on multiple versions of PHP, and can be downloaded here. Tutorial about using it here.

Rasmus Lerdorf的Vagrant box是在多个PHP版本上进行测试时要使用的 box,可以在此处下载。 有关在此处使用它的教程。

Travis CI has supported PHP 7 for a while now. Setting a project up to be 7-tested is easy, just make your .travis.yml file look something like this:

Travis CI已经支持PHP 7一段时间了。 将项目设置为经过7个测试很容易,只需使.travis.yml文件看起来像这样:

language: php php: - 5.6 - 7.0 - hhvm # This triggers builds to run on the new TravisCI infrastructure. # See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/ sudo: false matrix: allow_failures: - php: 7.0 before_script: - travis_retry composer self-update - travis_retry composer install --no-interaction --prefer-source script: - phpunit --coverage-text --coverage-clover=coverage.clover after_script: - if [[ $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != '7.0' ]]; then php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover; fi

The above was inspired by the PhpLeague skeleton – a PHP 7 ready skeleton package, so if you’re starting a new one, that’s where to look for a baseline.

上面的内容受PhpLeague框架的启发–一个PHP 7框架框架,因此,如果您要启动一个新的 ,则可以在这里寻找基线。

Right now, the hosting space is rather sparse for PHP 7, but keep an eye on http://phpversions.info/php-7/ – the list will be updated as new information rolls in.

目前,PHP 7的托管空间相对较少,但请留意http://phpversions.info/php-7/-该列表将随着新信息的发布而更新。

(Miscellaneous)

For resources on developing extensions for PHP 7 (things are bit different with the extension API), http://gophp7.org/gophp7-ext/ is still the go-to site.

有关开发PHP 7扩展的资源(扩展API的功能有些不同), http://gophp7.org/gophp7-ext/仍是首选站点。

To join communities and discuss things or seek help, some of the following may be of help, in order of popularity:

要加入社区并讨论事物或寻求帮助,按照普及程度的不同,以下某些方面可能会有帮助:

On IRC, the ##php group on freenode will be of use

在IRC上,将使用freenode上的## php组

For those in favor of a more static medium, the PHP subreddit can be a place of knowledge, but also a minefield. Tread carefully.

对于那些赞成使用更静态的媒体的人来说, PHP subreddit可以是一个知识的地方,而且可以是一个雷区。 小心踩一下。

If you’re not of the IRC or Reddit kind, but like live discussion nonetheless, there’s the PHP Slack Channel and the StackOverflow PHP chat room

如果您不是IRC或Reddit类型的人,但是仍然像现场讨论一样,这里有PHP Slack Channel和StackOverflow PHP聊天室

To join a user group for some offline hanging out, check out http://php.ug/

要加入用户组进行一些离线环聊,请访问http://php.ug/

结论 (Conclusion)

Got more resources to share? Let us know! Paid or not, we’ll look at everything you throw at us and potentially include it.

有更多资源可以分享? 让我们知道! 不论是否付费,我们都会查看您扔给我们的所有内容,并可能将其包括在内。

With PHP 7 out, do you intend to convert your apps/packages any time soon? If not, why? Let us know your thoughts and feelings below! And don’t forget – the new version wouldn’t have been possible without the hard work of all the core contributors. They may not always all see eye to eye, but when they pool their resources and run towards a common goal, the sky’s the limit. Here’s to you, champs, thanks for keeping the web epic!

随着PHP 7的发布,您打算尽快转换您的应用程序/软件包吗? 如果没有,为什么? 让我们在下面知道您的想法和感受! 而且请不要忘记-如果没有所有核心贡献者的辛勤工作,就不可能有新版本。 他们可能并不总是一见倾心,但是当他们集中资源并朝着一个共同的目标迈进时,天空就是极限。 冠军,这是给您的, 感谢您保持网络史诗!

翻译自: https://www.sitepoint.com/learn-php-7-find-out-whats-new-and-more/

php网站功能块学习

最新回复(0)