English 中文(简体)
没有服务器访问权限的PHP分析[重复]
原标题:PHP profiling with no server access [duplicate]
This question already has an answer here:
Closed 11 years ago.

Possible Duplicate:
PHP Profiler with method execution count, times etc. without extensions

所以,我不能使用xDebug或其他需要安装PECL扩展的东西,我只能访问FTP,所以我需要对我使用的函数进行一些测试,这是CodeIgniter的一个操作。

所以我用检查器查看了chrome,发现该页面的响应时间只有后端(该操作中使用的PHP函数)的22秒,没有DOM的东西。

有人知道一个好的工具吗?看看是什么导致负载如此巨大。

问题回答

如果没有实际的调试工具,echo可能是您唯一的调试工具。您可以在站点入口点的开头添加$start_time=microtime(true),并且可以在代码的不同位置打印或记录microtime(true)-$start_time

从文档

$this->benchmark->mark( code_start );

// Some code happens here

$this->benchmark->mark( code_end );

echo $this->benchmark->elapsed_time( code_start ,  code_end );

然而,这并不能告诉你为什么你的模型/控制器加载缓慢,但你可以封装任何请求来缩短有问题的加载时间。IE:你对一个模型进行基准测试,并意识到这是4个查询。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...