2d射线和3d射线的区别_要检出的十大Z射线功能

2d射线和3d射线的区别

This post was written by a developer who works on the Zend Server project. We’re pretty keen on editorial independence here at SitePoint, but occasionally we feature articles from people working directly on some of our favorite tools.

这篇文章是由从事Zend Server项目的开发人员撰写的。 我们在SitePoint上非常热衷于编辑的独立性,但有时我们会收录来自直接使用某些我们最喜欢的工具的人们的文章。

Necessity is the mother of invention goes the famous saying.

必然是发明之母成名。

For PHP developers, there is no greater need than visibility. But developers today have a tough choice to make as they develop and debug their apps. Either use crude methods such as printing, debugging information, or storing it in a log file, or – use multiple debugging/profiling tools that are awkward and require a lot of work from the developer’s side.

对于PHP开发人员,没有比可视性更大的需求了。 但是,当今的开发人员在开发和调试应用程序时会做出艰难的选择。 要么使用诸如打印,调试信息或将其存储在日志文件中之类的粗略方法,要么–使用笨拙且需要开发人员方面大量工作的多个调试/概要分析工具。

Either way – this means time. Time spent accessing the PHP log. Time spent accessing SQL queries. Time spent finding that one bad function or PHP error causing a bottleneck or crashing your app.

无论哪种方式-这都意味着时间。 访问PHP日志所花费的时间。 访问SQL查询所花的时间。 发现一个错误的功能或PHP错误导致瓶颈或使应用崩溃的时间。

This article introduces the top 10 features of Z-Ray – an innovative new technology from Zend that makes PHP development a whole lot quicker and easier by giving developers unprecedented insight into their code – and the visibility they need to develop top-notch apps.

本文介绍了顶Z-雷 10功能-从创新技术的Zend ,使得PHP开发一大堆通过为开发人员提供了前所未有的洞察他们的代码更快和更容易-他们需要开发一流的应用程序的可见性。

关于Zend服务器 (About Zend Server)

Zend Server is an integrated application platform for mobile and web PHP apps. It includes an advanced and secure PHP stack (which is fully compatible with php.net’s PHP and based on the same source code), with over 80 popular PHP extensions and libraries.

Zend Server是用于移动和Web PHP应用程序的集成应用程序平台。 它包括一个高级且安全PHP堆栈(与php.netPHP完全兼容,并且基于相同的源代码),并具有80多个流行PHP扩展和库。

Zend Server includes tools that help you develop, debug, deploy and monitor your PHP apps, together with advanced features for optimizing performance, scalability and reliability.

Zend Server包含可帮助您开发,调试,部署和监视PHP应用程序的工具,以及用于优化性能,可伸缩性和可靠性的高级功能。

Zend Server supports Apache, NGINX and IIS Web servers, and is delivered as native packages for all leading Linux distributions, Windows, MAC OS X and IBM i environments, including Cloud environments such as AWS.

Zend Server支持Apache,NGINX和IIS Web服务器,并作为本机软件包交付给所有领先的Linux发行版,Windows,MAC OS X和IBM i环境,包括AWS等云环境。

Zend Server supports any PHP code, and provides deep insight into that code, including popular PHP applications and frameworks like WordPress, Magento, Drupal, Zend Framework, Symfony, and Laravel.

Zend Server支持任何PHP代码,并提供对该代码的深入了解,包括流行PHP应用程序和框架,如WordPress,Magento,Drupal,Zend Framework,Symfony和Laravel。

See this overview for more information on what Zend Server is and how to install it.

有关什么是Zend Server以及如何安装的更多信息,请参见此概述

什么是Z射线? (What’s Z-Ray?)

Z-Ray is a Zend Server component that monitors requests made to the Web server, and then displays all the details of a page request, across all the PHP scripts involved in building the page, in a nifty toolbar at the bottom of your browser.

Z-Ray是一个Zend Server组件,它监视对Web服务器的请求,然后在浏览器底部的一个漂亮工具栏中,显示与构建页面有关的所有PHP脚本中页面请求的所有详细信息。

2d射线和3d射线的区别_要检出的十大Z射线功能

Z-Ray is injected into the response coming from your PHP app and shown right in front of you, in your browser. You do not have to tweak your code or change your development workflow at all – simply open your app in a browser or even on a mobile device.

Z-Ray被注入到来自您PHP应用程序的响应中,并显示在您的浏览器中。 您完全不必调整代码或更改开发工作流程–只需在浏览器中甚至在移动设备上打开应用程序即可。

Z-Ray is designed to be non-intrusive – it’s small enough to be ignored if you don’t care about the diagnostics of the page. But if you do, it’s right there at your fingertips – full of data about the page that was just rendered – without having to explicitly run any additional tool or recreate the request. Z-Ray will also attempt to catch your attention if it has something important to tell you by displaying a red flag icon, if a critical error or event has occurred.

Z-Ray被设计为非侵入式的-如果您不关心页面的诊断信息,它的大小可以忽略不计。 但是,如果您这样做,它就在您的指尖–包含有关刚渲染页面的全部数据–无需显式运行任何其他工具或重新创建请求。 如果发生重大错误或事件,如果通过显示红色标志图标来告诉您重要的事情,Z-Ray也会尝试引起您的注意。

Z-Ray的前10名 (Z-Ray’s Top-10)

The remainder of the article will outline Z-Ray’s top 10 features. At the end of the article, you’ll find useful links you can check out to learn about additional Z-Ray features. Let’s start the countdown!

本文的其余部分将概述Z-Ray的十大功能。 在本文的结尾,您将找到有用的链接,可以查看有关其他Z-Ray功能的信息。 让我们开始倒计时!

10.页面请求 (10. Page Requests)

The Page Requests panel in Z-Ray lists all the requests sent from your page to the Web server, with information on their response, method, path, the time they took, and the amount of executed DB queries. If an error occurred during execution, you’ll know about it because of a colored flag that appears beside the request.

Z-Ray中的“页面请求”面板列出了从页面发送到Web服务器的所有请求,以及有关它们的响应,方法,路径,花费的时间以及已执行的数据库查询的数量的信息。 如果在执行过程中发生错误,由于请求旁边会出现一个彩色标志,您会知道的。

In case of multiple requests such as ajax calls, you can drill down into a specific sub-request by selecting it from the requests list. Z-Ray is then filtered accordingly and displays data for that request only.

如果有多个请求(例如ajax调用),则可以通过从请求列表中选择特定的子请求来向下钻取。 然后,对Z射线进行相应的过滤,并仅显示该请求的数据。

9.执行时间和内存消耗 (9. Execution Time and Memory Consumption)

Not sure how much server time is being wasted processing database queries? The Execution Time and Memory Peak panel in Z-Ray is a great way to get a general idea of how your server resources were consumed by the request. It displays the peak memory usage and gives you a breakdown (PHP, Database, IO, Network) of the request to help you understand how it was processed by the web server.

不确定在处理数据库查询上浪费了多少服务器时间? Z-Ray中的“执行时间和内存峰值”面板是一种很好的方式,可以使您大致了解请求如何使用服务器资源。 它显示峰值内存使用情况,并为您提供请求的细分(PHP,数据库,IO,网络),以帮助您了解Web服务器如何处理请求。

8.监视事件 (8. Monitor Events)

The Z-Ray Monitor Events panel gives you a list of any Zend Server “monitoring events” that may have been triggered by the request, alerting you of PHP errors, high memory usage, slow request execution, and more, as defined by your monitoring rules in Zend Server. More about Zend Server Monitoring…

“ Z-Ray监视器事件”面板为您提供了可能由请求触发的任何Zend Server“监视事件”的列表,向您警告PHP错误,内存使用率高,请求执行缓慢等(由监视定义) Zend Server中的规则。 有关Zend Server监视的更多信息……

You can see the full details on the event in the Zend Server UI – just click the corresponding icon for the event. If a code trace was triggered for the event, it can be accessed directly from Z-Ray as well. More about Zend Server Code Tracing…

您可以在Zend Server用户界面中查看有关事件的完整详细信息,只需单击事件的相应图标即可。 如果为事件触发了代码跟踪,则也可以直接从Z-Ray访问它。 有关Zend服务器代码跟踪的更多信息……

7.错误和警告 (7. Errors and Warnings)

Accessing PHP logs is not a very popular debugging method. It’s awkward and can be time consuming. The Errors and Warnings panel in Z-Ray saves you the bother by displaying uncaught exceptions, errors generated by PHP itself, or those created by its core functions. You’ll be able to see when the error was created, its type, and the actual error message.

访问PHP日志不是一种非常流行的调试方法。 这很尴尬,而且很耗时。 Z-Ray中的“错误和警告”面板通过显示未捕获的异常,PHP本身生成的错误或由其核心功能创建的错误,为您节省了麻烦。 您将能够看到错误的创建时间,错误的类型以及实际的错误消息。

A neat feature in this panel is the ability to see entries for expressions silenced by the @ operator. To see these entries, all you have to do is select the ‘@Silenced’ check-box in the filtering area on the left.

此面板中的一个巧妙功能是能够查看由@运算符静音的表达式的条目。 要查看这些条目,您要做的就是选中左侧过滤区域中的“ @Silenced”复选框。

Clicking the Backtrace icon on the right displays a complete backtrace of the error, giving you the larger picture of what went wrong.

单击右侧的Backtrace图标将显示错误的完整回溯,从而使您可以更全面地了解发生了什么问题。

6.索取信息 (6. Request Info)

In the Z-Ray Request Info panel, you’ll get a wide array of information about the request.

在“ Z-Ray请求信息”面板中,您将获得有关请求的各种信息。

Firstly, you’ll get a list of the PHP superglobals used in your code. So, for instance, you’ll be able to easily identify if values for your SESSION or COOKIE superglobals changed, and how, including the actual size of the variable.

首先,您将获得代码中使用PHP超全局变量的列表。 因此,例如,您将能够轻松识别SESSION或COOKIE超全局变量的值是否更改以及更改方式,包括变量的实际大小。

In addition, you’ll be able to see the request headers, raw post data – if available, and response headers and body.

此外,您将能够看到请求标题,原始帖子数据(如果有)以及响应标题和正文。

2d射线和3d射线的区别_要检出的十大Z射线功能

5.生产中的Z射线 (5. Z-Ray in Production)

Z-Ray allows developers to analyze code and identify errors early on in the development cycle and way before going into production. However, Z-Ray can be safely used in production as well using access tokens passed as GET parameters in the application’s URL.

Z-Ray允许开发人员在开发周期和早期投入生产之前就分析代码并识别错误。 但是,Z-Ray可以安全地用于生产中,也可以使用在应用程序的URL中作为GET参数传递的访问令牌来安全使用。

Access tokens are easily managed and created using the Zend Server user interface, and can be limited per IP address, per URL, and for a specific time period.

使用Zend Server用户界面可以轻松管理和创建访问令牌,并且可以按IP地址,URL和特定时间限制访问令牌。

2d射线和3d射线的区别_要检出的十大Z射线功能

4.功能 (4. Functions)

Applications can call hundreds and thousands of PHP functions during execution. Getting visibility into slow or bad-performing functions can be crucial in analyzing performance.

应用程序在执行期间可以调用成千上万PHP函数。 深入了解慢速或性能不佳的功能对于分析性能至关重要。

In the Z-Ray Functions panel, you’ll be able to see all the PHP functions called during the request; their name, how many times they were called, the time spent in the scope of the functions, including and excluding time spent in children functions, and more.

在“ Z-Ray函数”面板中,您将能够看到在请求期间调用的所有PHP函数。 它们的名称,被调用的次数,在函数范围内花费的时间,包括(但不包括)在子函数上花费的时间,等等。

Functions can be filtered according to function groups and namespaces using default filters. You can also create your own function filters. See how here. Additionally, like in the other panels in Z-Ray, the information can be sorted according to a column title so it’s very easy to quickly identify slow functions for example.

可以使用默认过滤器根据功能组和名称空间过滤功能。 您也可以创建自己的函数过滤器。 看看这里如何。 另外,就像在Z-Ray中的其他面板中一样,可以根据列标题对信息进行排序,因此例如快速识别慢速功能非常容易。

To make profiling and sharing with colleagues easier, there is an export button in the corner for generating an HTML-based report.

为了简化配置文件和与同事共享,角落中有一个导出按钮,用于生成基于HTML的报告。

3.应用程序/框架支持和可扩展性 (3. App/Framework Support and Extensibility)

One of the niftiest features in Z-Ray is the ability to extend it.

Z射线最漂亮的功能之一就是能够对其进行扩展。

Using extension APIs, (available on GitHub) you can plug in your very own Z-Ray extension, or – customize existing extensions. So no matter what application you’re developing, or what platform/framework you’re using – you can ask Z-Ray to track and display information you think would optimize your development workflow.

使用扩展API(可在GitHub上获得 ),您可以插入自己的Z-Ray扩展,或–自定义现有扩展。 因此,无论您正在开发哪种应用程序,或正在使用什么平台/框架,您都可以要求Z-Ray跟踪并显示您认为可以优化开发工作流程的信息。

In fact, this capability was used to equip Z-Ray with built-in support for popular PHP applications and frameworks such as WordPress, Magento, Drupal, ZF1, ZF2, Symfony, Laravel, and more. This means that if you’re developing one of these apps/frameworks, Z-Ray will automatically display additional panels with app/framework-specific information.

实际上,此功能用于为Z-Ray配备对流行PHP应用程序和框架(如WordPress,Magento,Drupal,ZF1,ZF2,Symfony,Laravel等)的内置支持。 这意味着,如果您正在开发这些应用程序/框架之一,则Z-Ray将自动显示带有特定于应用程序/框架的信息的其他面板。

All this works out of the box, without any extra configuration on your part. Simply open the app in a browser.

所有这些都是开箱即用的,无需您进行任何额外的配置。 只需在浏览器中打开该应用程序即可。

The process of developing a Z-Ray extension is extremely simple and can boil down to just a few lines of code. Check out this tutorial to learn just how simple it is.

开发Z-Ray扩展的过程非常简单,并且可以简化为几行代码。 查看本教程 ,了解它是多么简单。

Z-Ray’s eco-system is growing on a weekly basis, with more and more extensions contributed by the PHP community, including extensions for Joomla, OPcache, Doctrine2, Redis, OroCRM, and more.

Z-Ray的生态系统每周都在增长,PHP社区贡献了越来越多的扩展,包括JoomlaOPcacheDoctrine2RedisOroCRM等等的扩展

2.调试手机和API (2. Debugging Mobile and APIs)

All of the above described information is displayed by Z-Ray for an application open in a browser. But what about mobile applications? What if you’re developing APIs and Web services?

Z-Ray针对浏览器中打开的应用程序显示所有上述信息。 但是移动应用程序呢? 如果要开发API和Web服务怎么办?

Non-browser based requests are displayed on Z-Ray Live! – a dedicated page inside the Zend Server user interface. While in development, and from the moment this page is loaded, Z-Ray will record and display any request made to the web server, regardless of its origin – a browser, a mobile device or a web-service client. All the information displayed for an app open in a browser is displayed here as well – no exception.

基于非浏览器的请求将显示在Z-Ray Live! – Zend Server用户界面内的专用页面。 在开发过程中,从加载此页面开始,Z-Ray会记录并显示对Web服务器的任何请求,无论其来源是浏览器,移动设备还是Web服务客户端。 在浏览器中打开的应用程序显示的所有信息也都显示在此处-也不例外。

Take a closer look at just how easy this is in this video – Developing Mobile Apps and APIs with Z-Ray Live!

仔细看一下这段视频的简单性– 使用Z-Ray Live开发移动应用程序和API!

1.数据库查询 (1. Database Queries)

Database Queries is one of the features in Z-Ray that PHP developers are most hyped about and that’s why I listed it in 1st place. In a way, this panel symbolizes what Z-Ray is all about – giving you critical information about your app that was previously very hard and time-consuming to get your hands on.

数据库查询是PHP开发人员最热衷的Z-Ray功能之一,因此我将其列在第一位。 在某种程度上,该面板象征着Z-Ray的全部含义-为您提供有关应用程序的重要信息,而这些信息以前很难动手且费时。

The Database Queries panel beautifully outlines all the SQL queries executed by the request, displaying priceless information about each query – such as a query’s bound value, it’s result, how long it took and the number of affected rows.

“数据库查询”面板很好地概述了请求执行的所有SQL查询,显示了有关每个查询的无价信息,例如查询的绑定值,结果,花费的时间以及受影响的行数。

Even though getting a list of the queries your page has executed is typically extremely important during development and debugging, the reality is that without Z-Ray – it’s often not easy or practical to obtain. Developers who develop against a company database may not have access to the database query log due to security considerations. Some databases (such as SQLite) don’t even have a query log to begin with. And even if you do have access to the query log, extracting the queries that were run specifically from the page you’re looking into may not be easy, as the query log contains a mix of all of the queries from all of the different pages, potentially also from other developers working with that database at the same time. Z-Ray’s in-context query list is therefore a lot more powerful, and at the same time very easy to use.

尽管获取页面已执行查询的列表在开发和调试过程中通常非常重要,但现实是,如果没有Z-Ray,获取它通常并不容易或不切实际。 出于安全考虑,针对公司数据库进行开发的开发人员可能无法访问数据库查询日志。 有些数据库(例如SQLite)甚至根本没有查询日志。 而且即使您有权访问查询日志,也可能不容易从要查找的页面中提取专门运行的查询,因为查询日志包含来自所有不同页面的所有查询的混合,也可能来自同时使用该数据库的其他开发人员。 因此,Z-Ray的上下文内查询列表功能强大得多,并且同时非常易于使用。

To get the larger picture on how your code was executed, you can also produce a fully detailed, and printable, backtrace for a query. This is especially useful if you use a database abstraction layer – where determining where the query came from may not be possible from just looking at the filename and line number where it was invoked.

为了更全面地了解代码的执行方式,您还可以为查询生成完全详细且可打印的回溯。 如果您使用数据库抽象层,则这特别有用-在数据库抽象层中,仅通过查看调用文件名和行号就可能无法确定查询的来源。

有用的链接 (Useful Links)

Here are some additional information sources that you will find useful: * Live demos: WordPress | Drupal | Magento | ZF2 | Laravel * Z-Ray videos * Z-Ray Extension API * Zend.com

以下是一些其他有用的信息源:*现场演示: WordPress | Drupal | Magento | ZF2 | Laravel * Z-Ray视频 * Z-Ray扩展API * Zend.com

反馈 (Feedback)

As Z-Ray is an ongoing project, you can send your comments or ideas using one of the following channels: [email protected] | [email protected] | @proudboffin

由于Z-Ray是一个正在进行的项目,因此您可以使用以下一种渠道发送您的意见或想法:[email protected] | [email protected] | @proudboffin

To learn about how to write your own Z-Ray extension, see this tutorial.

要了解如何编写自己的Z-Ray扩展名,请参阅本教程

翻译自: https://www.sitepoint.com/top-10-z-ray-features-check/

2d射线和3d射线的区别