首页  >  文章  >  后端开发  >  php鎬ц兘浼樺寲鍒嗘瀽宸ュ叿XDebug 澶у瀷缃戠珯璋冭瘯宸ュ叿_PHP鏁欑▼ | 甯涔嬪

php鎬ц兘浼樺寲鍒嗘瀽宸ュ叿XDebug 澶у瀷缃戠珯璋冭瘯宸ュ叿_PHP鏁欑▼ | 甯涔嬪

WBOY
WBOY原创
2016-07-21 15:28:571614浏览

涓€銆佸畨瑁呴厤缃?
銆€銆€1銆佷笅杞絇HP鐨刋Debug鎵╁睍锛岀綉鍧€锛歨ttp://xdebug.org/

銆€銆€2銆佸湪Linux涓嬬紪璇戝畨瑁匵Debug

寮曠敤
tar -xzf xdebug-2.0.0RC3.gz
cd xdebug-2.0.0RC3
/usr/local/php/bin/phpize
./configure --enable-xdebug
cp modules/xdebug.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20020429/

銆€銆€娉細/usr/local/php/lib/php/extensions/no-debug-non-zts-20020429/涓嶅悓鐨凱HP鐗堟湰璺緞涓嶅悓锛屼篃涓嶄竴瀹氳鏀惧湪璇ヨ矾寰勶紝鍙互鍦▃end_extension_ts涓嚜琛屾寚瀹歺debug.so鎵€鍦ㄤ綅缃€?

寮曠敤
vi /usr/local/php/lib/php.ini

銆€銆€淇敼php.ini锛屽幓闄HP鍔犻€熸ā鍧楋紝澧炲姞浠ヤ笅閰嶇疆淇℃伅鏀寔XDebug鎵╁睍

澶嶅埗浠g爜 浠g爜濡備笅:

[Xdebug]
zend_extension_ts="/usr/local/php/lib/php/extensions/no-debug-non-zts-20020429/xdebug.so"
xdebug.profiler_enable=on
xdebug.trace_output_dir="/tmp/xdebug"
xdebug.profiler_output_dir="/tmp/xdebug"
xdebug.profiler_output_name="script"

寮曠敤
mkdir -p /tmp/xdebug
chmod 755 /tmp/xdebug
chown www:www /tmp/xdebug
/usr/local/apache/bin/apachectl -k restart


銆€銆€3銆佸鎴风锛圵indows锛夛細WinCacheGrind
銆€銆€涓嬭浇鍦板潃锛歨ttp://sourceforge.net/projects/wincachegrind/

銆€銆€浜屻€佸垎鏋愯繃绋?
銆€銆€1銆佽闂綘鐨勭綉绔欙紝灏嗛椤典笂鍚勭閾炬帴鐐瑰嚮鍑犻亶锛孹Debug鍦?tmp/xdebug鐩綍鐢熸垚浠ヤ笅鏂囦欢锛?
銆€銆€usr_local_apache_htdocs_app_checknum_chknum_php_cachegrind.out
銆€銆€usr_local_apache_htdocs_app_login_showHeaderLogin_php_cachegrind.out
銆€銆€usr_local_apache_htdocs_app_play_play_php_cachegrind.out
銆€銆€usr_local_apache_htdocs_app_user_member_php_cachegrind.out
銆€銆€usr_local_apache_htdocs_tag_tags_php_cachegrind.out
銆€銆€usr_local_apache_htdocs_top_top_php_cachegrind.out

銆€銆€2銆佸皢浠ヤ笂鏂囦欢鎷疯礉鍒癢indows涓婏紝鐢ㄥ鎴风杞欢WinCacheGrind鎵撳紑姣忎釜鏂囦欢锛屽彂鐜颁互涓婸HP绋嬪簭鎵ц鎵€鑰楄垂鐨勬椂闂存渶闀匡細
銆€銆€/usr/local/apache/htdocs/tag/tags.php銆€銆€銆€銆€銆€銆€鑰楁椂840ms

銆€銆€涓夈€佸垎鏋愮粨鏋滐細
銆€銆€1銆?usr/local/apache/htdocs/tag/tags.php



銆€銆€(1)鑰楁椂鏈€闀跨殑filter_tags鍑芥暟鍑虹幇鍦?usr/local/apache/htdocs/tag/tags.php鐨勭158琛岋細
銆€銆€$tags .= filter_tags($videos[$i]['tags'])." ";

銆€ 銆€(2)filter_tags鍑芥暟寮曡嚜/usr/local/apache/htdocs/include /misc.php锛実etForbiddenTags鍑芥暟琚玣ilter_tags鍑芥暟璋冪敤浜?1娆★紝filter_tags鍑芥暟鑰楄垂鐨勬椂闂翠腑缁濆ぇ澶氭暟 鍥爂etForbiddenTags鍑芥暟鎵€鑷淬€俫etForbiddenTags鍑芥暟鐨勫唴瀹瑰涓嬶細

澶嶅埗浠g爜 浠g爜濡備笅:

function getForbiddenTags()
{

$tagsPath=TEMPLATE_FILE_PATH."tags/forbidden_tags.txt";
if(file_exists($tagsPath))
{
$fp = fopen($tagsPath, "r");
$arrconf = array ();
if ($fp)
{
while (!feof($fp))
{
$line = fgets($fp, 1024);
$line = trim($line);
$rows = explode("#", $line);
$coumns = explode("=", trim($rows[0]));
if(""!=trim($coumns[0]))
{
$arrconf[trim($coumns[0])] = trim($coumns[1]);
}
}
}
return $arrconf;
}
}

(4)瀵筭etForbiddenTags鍑芥暟杩涜鍒嗘瀽锛屽叾涓殑PHP鍑芥暟trim琚皟鐢ㄤ簡16827娆°€?BR>銆€銆€

銆€銆€(5)鍙兘閫犳垚鐡堕鐨勫師鍥狅細
銆€銆€瑕佽繃婊ょ殑156涓叧閿瓧閫愯瀛樻斁鍦?usr/local/apache/template/tags/forbidden_tags.txt鏂囦欢涓紝鏂囨湰鏁版嵁搴撶殑鏁堢巼涓嶉珮銆?BR>銆€銆€閫愯璇诲彇鍑芥暟fgets銆佷互鍙婂幓闄ゅ瓧绗︿覆涓よ竟鐨勭┖鐧芥垨鑰呮寚瀹氱殑瀛楃鐨勫嚱鏁皌rim鍦ㄩ珮璐熻浇涓嬬殑鏁堢巼浣庯紝鍙互娴嬭瘯fopen銆乫read銆乫scanf涔嬬被鐨勬枃浠惰鍙栧嚱鏁帮紝瀵规瘮涓€涓嬨€?/P>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/323508.htmlTechArticle涓€銆佸畨瑁呴厤缃?1銆佷笅杞絇HP鐨刋Debug鎵╁睍锛岀綉鍧€锛歨ttp://xdebug.org/ 2銆佸湪Linux涓嬬紪璇戝畨瑁匵Debug 寮曠敤 tar -xzf xdebug-2.0.0RC3.gz cd xdebug-2.0.0RC3 /usr/local/php/...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn