How To Debug Execution Path in PHP��Equivalent of printStackTrace() in Java �� �̿� �����ϴ� ��ο� php�� ������ϴ� ����� ���� printStackTrace�� ()�� �ڹ�
While programming in PHP often you will find that a simple echo or log statement is not sufficient. ���α��� php �����ϴ� ���� ������ ���� �Ǵ� �α��� �˰Ե˴ϴ� ������ ������� �����մϴ�. You have found out where a problem is happening but you have no clue why it is executing that code in the first place. ����� ��� ������ �߰��� �Ͼ�� ���� ����� �ƹ� �ܼ��� �� ó���� �� �ڵ带 �����մϴ�. This is where execution path comes in handy. �̰��� ���� ��θ� ��� �����մϴ�. With a simple call you can display the whole execution path of the code so far, every function that was executed, in which file and in which line number. �ִ� ������ ��ȭ �ڵ��� ���� ��θ� ǥ���� ���ֽ��ϴ� ���ݱ��� ���, ��� ����� ����Ǹ� �� ��ȣ���ִ� �������մϴ�. Isn't that handy? ���� �ڵ�?
Use debug_print_backtrace() to print the full execution path of the code upto that point. ��� debug_print_backtrace ()�� �μ��մϴ� �� �������� ��ü �ڵ��� ���� ����մϴ�. You can also use debug_backtrace() which returns an associative array with the following data: �� ����� �����ֽ��ϴ� debug_backtrace ()�� ������ ���� ������ ���� �迭�� ��ȯ�մϴ� :
Possible returned elements from debug_backtrace() ��ȯ�� ��Ҹ� ���ֽ��ϴ� debug_backtrace ()
| Name �̸� | Type ���� | Description ���� |
|---|---|---|
| function �Լ� | string ���ڿ� | The current function name. ������ �Լ� �̸�. See also ���� |
| line �� | integer ���� | The current line number. ������ �� ��ȣ�մϴ�. See also ���� __LINE__. __line__�մϴ�. |
| file ���� | string ���ڿ� | The current file name. ������ ���� �̸����մϴ�. See also ���� __FILE__. __file__�մϴ�. |
| class Ŭ���� | string ���ڿ� | The current class name. ������ Ŭ���� �̸�. See also ���� |
| type ���� | string ���ڿ� | The current call type. ������ ��ȭ �����մϴ�. If a method call, "->" is returned. ��쿡�� �ҵ� ȣ��, "->"�� ��ȯ�մϴ�. If a static ��ü�Ǵ� ��쿡�� method call, "::" is returned. ���� ȣ��, ": :"�� ��ȯ�˴ϴ�. If a function call, nothing is returned. �� �Լ� ȣ��, �ƹ��͵��� ��ȯ�˴ϴ�. |
| args | array �迭 | If inside a function, this lists the functions arguments. ���� ���ο��� �����,�� ����� ����� �μ��մϴ�. If ���� |
Filed under �ؿ� Headline News ��� ���� ���� , How To �ϴ� ����� , Java Software �ڹ� ����Ʈ���� , Open Source Software ���� �ҽ� ����Ʈ���� , PHP php , Programming ���α��� , Tech Note ��� ��� ���� , Web �� | |
| |
RSS 2.0 rss 2.0 | |
Trackback Ʈ���� this Article | �� ���� |
Email this Article ���� ������ ����
You may also like to read ������ ���� ���ֽ��ϴ� |




































