php7中方法 :?的使用
The web development world is vastly overpopulated by newbies, especially in easy-entry languages like PHP. The percentage of people who tack on “PHP dev” to their CVs after having been only through a single tutorial or having built a single WordPress blog, is shockingly high. When big-shot CEOs outsource their production to the cheapest freelancer they can find, it’s no surprise the project fails or gets delayed into infinity.
在Web开发世界中,新手人数过多,尤其是在像PHP这样的易于输入的语言中。 仅通过单个教程或建立了一个WordPress博客后,就将“ PHP开发人员”加入其简历的人的比例令人震惊地高。 当有远见的首席执行官将他们的生产外包给他们能找到的最便宜的自由职业者时,项目失败或被推迟到无限期就不足为奇了。
This unhealthy loop is a big part of PHP’s bad reputation, because bad practices propagated by bad resources and bad developers persist in the modern world which, effectively, outgrew them. We can’t keep the newbies away, and we can’t educate the clients because most clients learn exclusively on mistakes.
这个不健康的循环是PHP不良声誉的很大一部分,因为不良资源和不良开发人员传播的不良做法在现代世界中持续存在,实际上已经超过了它们。 我们不能让新手离开,也不能教育客户,因为大多数客户都是专门学习错误的。
Shared host environments are also to blame, because their plans seldom include the most recent version of PHP, and are, due to price and ease of use, still the preferred hosting solution for legions of newcomers. So what can we do to spread best practices?
共享主机环境也应受到指责,因为它们的计划很少包括最新版本PHP,并且由于价格和易用性,它们仍然是许多新手的首选主机解决方案。 那么,我们可以做些什么来推广最佳实践呢?
PTRW is a community effort, a website built entirely around spreading best up-to-date PHP practices. It’s far from exhaustive – instead, it tries to bullet-list the things you should pay attention to, and links to quality resources where one can learn more about the various aspects it covers.
PTRW是一个社区活动, 它是一个完全基于传播最佳最新PHP做法而建立的网站。 它远非详尽无遗-相反,它试图列出您应注意的事项,并链接到优质资源,使人们可以了解其涵盖的各个方面的更多信息。
The site is regularly updated and accepts pull requests through GitHub. It’s available in several languages, and covers topics ranging from Vagrant and the built-in PHP server, to containers, dependency injection, proper password hashing, and more.
该网站会定期更新,并通过GitHub接受拉取请求。 它有多种语言版本,涵盖了从Vagrant和内置PHP服务器到容器,依赖项注入,正确的密码哈希等等的主题。
To help spread the word of proper PHP, read through the site and share it with everyone you know that as much as dabbles in PHP – the net gain is immeasurable and the lives of developers and clients both will profit from it greatly.
为了帮助传播正确PHP话,请通读该网站并与所有人分享,您会发现PHP涉足不尽–净收益是无法估量的,开发人员和客户的生活都会从中受益匪浅。
Those more knowledgeable among you might be wondering why I’m writing about PTRW now, if it’s been around for years. It’s because PTRW recently got published as a book on Leanpub.
你们当中那些知识渊博的人可能想知道,如果已经有很多年了,为什么我现在要写有关PTRW的文章。 这是因为PTRW最近在Leanpub上以书的形式出版 。
The book is little more than the printed and edited PDF version of the site. It’s a 50 page manuscript with 40 pages of content you can consume, and is identical in every regard to the PTRW site as it stands at the time of this writing. Why, then, would anyone purchase it?
这本书仅是该网站的印刷和编辑PDF版本。 这是一本50页的手稿,其中包含40页的内容,您可以使用,并且在撰写本文时与PTRW网站在各个方面都相同。 那么,为什么有人会购买呢?
The book is “pay-what-you-want”, even if you don’t want to pay anything. It can be downloaded free of charge, no strings attached. However, should you decide to purchase the book (i.e. pay any sum before downloading it), 100% of the proceeds go to EFF, the Electronic Frontier Foundation.
即使您不想支付任何费用,这本书也是“按您想要的付出”。 可以免费下载,不附带任何条件。 但是,如果您决定购买该书(即在下载前支付任何款项),则收益的100%将流向电子前沿基金会 EFF。
Defending your rights in the digital world
在数字世界捍卫您的权利
EFF is a donor funded non profit organization consisting of tech, legal and other experts. These experts come together and fight for the individual and the public in court cases against digital rights oppressors such as the US DOJ or Apple and similar. Every donation sent their way makes a new court victory possible, and helps keep one of the main defenders of our digital lives in operation. While the EFF is, unfortunately, very much US-oriented, every victory on American soil makes similar victories in other parts of the world possible, by providing local digital rights defenders with good arguments reusable elsewhere.
EFF是由技术,法律和其他专家组成的捐助方资助的非营利组织。 这些专家聚集在一起,在法院针对数字版权压迫者(例如美国司法部或苹果公司等)的个人和公众斗争。 每笔捐款都会使新的法庭胜利成为可能,并有助于保持我们数字生活的主要捍卫者之一的运转。 不幸的是,EFF非常面向美国,但在美国本土取得的每一次胜利,都可以通过为本地数字版权维护者提供在其他地方可重复使用的良好论据,从而在世界其他地区取得类似的胜利。
The book is authored by the community, but the main drivers of the compilation and editing effort are Phil Sturgeon and Josh Lockhart. While you can get to know them at their respective websites/twitter accounts, Phil was kind enough to lend me a couple minutes of his time and answer some questions about the actual book:
这本书是由社区编写的,但是编译和编辑工作的主要驱动力是Phil Sturgeon和Josh Lockhart 。 尽管您可以在各自的网站/推特帐户上认识他们,但Phil还是很乐意借给我几分钟时间,并回答有关实际书籍的一些问题:
Content-wise, what does the book offer that the site doesn’t, if anything?
就内容而言,这本书提供了网站没有的内容(如果有的话)?
Phil: Literally nothing, its the same thing.
菲尔:从字面上看,没有什么是同一回事。
Is the book going to be an effort as continuous as the site? In other words, do you intend to keep it in sync with the site and keep it on offer at Leanpub indefinitely?
这本书会像网站一样持续不断吗? 换句话说,您是否打算使其与网站保持同步并无限期地在Leanpub上提供?
Phil: It will be updated whenever I run a little PHP script I have locally, which converts GitHub Markdown to LeanPub Markdown.
Phil:只要我在本地运行一个小PHP脚本,它将更新,它将GitHub Markdown转换为LeanPub Markdown。
How many downloads has the book seen so far? How many of those were paid? What was the average contribution?
到目前为止,该书有多少次下载? 其中有多少是已付款的? 平均贡献是多少?
Phil: 411 at time of writing, but we only tweeted about it yesterday. Before that it had been sat around unannounced at had about 125 users, so that is a lot of downloads in 24 hours.
菲尔:在撰写本文时为411,但我们昨天才发过推文。 在此之前,它大约有125位用户被暗中宣布,因此24小时之内就有大量下载。
Of the 411 we’ve had 80 people donate, with an average donation price of $3.80 USD.
在411家中,有80人进行了捐赠,平均捐赠价格为3.80美元。
Are there any plans to expand the content for the book version? For example, “The Basics” page is linked, but perhaps more would be to gain if it were included in the text itself.
是否有计划扩展书籍版本的内容? 例如,“基础”页面已链接,但如果将其包含在文本本身中,则可能会有所收获。
Phil: That sounds like it could be a good idea. I’d have to write a lot more regex for that, but yes grouping in some of the wiki content would be valuable.
菲尔:听起来可能是个好主意。 为此,我必须编写更多的正则表达式,但是可以,在某些Wiki内容中进行分组很有价值。
Are there plans for a print version, depending on demand?
是否根据需求有印刷版本的计划?
Phil: I’m not sure of the legality of that. Currently the content of the book is licensed as Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (http://creativecommons.org/licenses/by-nc-sa/3.0/), which means we cannot use the material for commercial purposes, even if we wanted to.
菲尔:我不确定这样做是否合法。 目前,该书的内容已获许可以知识共享署名-非商业性-相同方式共享3.0( http://creativecommons.org/licenses/by-nc-sa/3.0/ ),这意味着我们不能将其用于商业目的,即使我们想要。
LeanPub is not an issue as we donate every penny to charity, it is still using the same license and is still noncommercial. Anything else though would be an issue.
LeanPub并不是问题,因为我们将每一分钱都捐赠给慈善机构,它仍然使用相同的许可证,并且仍然是非商业性的。 尽管有其他任何问题。
Obviously for a printed copy to exist we’d need to charge for it in the stores, and that would be commercial use, unless we set up some sort of non-profit organization and even then it sounds dodgy and like a lot of hard work.
显然,要存在印刷版,我们需要在商店中收费,并且这将用于商业用途,除非我们建立了某种非营利组织,即使如此,它听起来也很狡猾,并且需要大量的辛勤工作。
I think, for now, LeanPub will be the extent of it. If a lawyer would like to get in touch and offer his or her services to us for free then maybe that will change.
我认为,就目前而言,LeanPub将是它的范围。 如果律师想取得联系并免费向我们提供他或她的服务,那么情况可能会改变。
How about the book in other languages? Are authors of the PTRW translations free to put those up on Leanpub as well?
那本书用其他语言怎么样? PTRW翻译的作者是否也可以自由地将其发表在Leanpub上?
They are welcome to do so. I have made my conversion script publicly available for exactly that reason: https://github.com/philsturgeon/phptherightway-book
欢迎他们这样做。 正是由于这个原因,我才公开提供了转换脚本: https : //github.com/philsturgeon/phptherightway-book
What made you decide on EFF as the cause to contribute to?
是什么让您决定将EFF作为做出贡献的原因?
They are doing some amazing work to keep the internet free, open, and impartial. They are organizing important protests, raising awareness of sneaky stuff that most of us nerds would miss otherwise, and generally fighting in our corner.
他们正在做一些令人惊奇的工作,以保持互联网的自由,开放和公正。 他们正在组织重要的抗议活动,提高人们对我们大多数书呆子们否则会想念的偷偷摸摸的东西的认识,并且通常在我们的角落里战斗。
It also seemed a little more relevant to the content of the book than the “Shakespearean Authorship Trust” or “Liberty in Northern Korea”, even though they are no doubt worth causes.
尽管这无疑是值得的,但它似乎比“莎士比亚作者基金会”或“朝鲜的自由”与本书的内容更为相关。
Any other causes, efforts or good resources you’d like our readers to be aware of? Or bad ones they should avoid?
您希望我们的读者知道其他任何原因,努力或丰富资源吗? 还是应该避免的不好?
I don’t think its my place to comment on wether a cause is good or bad, and I am not personally familiar with any of the other causes supported by LeanPub. I would like to see them supporting http://www.autismspeaks.org/ in the near future though, as I would certainly switch the donations of my Building APIs You Wont Hate https://leanpub.com/build-apis-you-wont-hate to them.
我不认为要评论一个原因是好是坏,我个人也不熟悉LeanPub支持的任何其他原因。 我希望看到他们在不久的将来支持http://www.autismspeaks.org/ ,因为我当然会切换您对Building API的捐赠,但您不会讨厌https://leanpub.com/build-apis-you -讨厌他们。
PTRW is a valiant effort in making sure we’re all in sync when working with PHP. It’s a good starting point for any new PHP enthusiast, and should be the first stop of their PHP journey. Now in book form and backing a powerful cause, PTRW should contribute to the betterment of the digital world even more. Help the cause by spreading the word, contributing to the site or donating even the smallest amount – the community appreciates it.
PTRW是确保我们在使用PHP时保持同步的一种英勇努力。 对于任何新PHP爱好者来说,这都是一个很好的起点,并且应该是他们PHP旅程的第一步。 PTRW现在以书本形式并有强大的后盾,它应该为改善数字世界做出更大贡献。 通过传播信息,对网站做出贡献或捐赠最小的钱来帮助事业,社区对此表示赞赏。
翻译自: https://www.sitepoint.com/php-right-way-book/
php7中方法 :?的使用
相关资源:jdk-8u281-windows-x64.exe