How To Debug Execution Path in PHP…Equivalent of printStackTrace() in Java How To Debug Execução Caminho em PHP… equivalente de printStackTrace () em Java
While programming in PHP often you will find that a simple echo or log statement is not sufficient. Embora a programação em PHP muitas vezes você irá encontrar eco do que um simples registro ou declaração não é suficiente. You have found out where a problem is happening but you have no clue why it is executing that code in the first place. Você encontrou um problema de onde se está a passar, mas você não tem nenhum indício por que razão é que o código executando em primeiro lugar. This is where execution path comes in handy. Isto é onde execução caminho vem em acessível. 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. Com uma simples chamada você pode mostrar todo o caminho da execução do código até agora, cada função que foi executado, na qual arquivo, e no qual linha número. Isn’t that handy? Que não é útil?
Use debug_print_backtrace() to print the full execution path of the code upto that point. Use debug_print_backtrace () para imprimir o caminho completo execução do código até que ponto. You can also use debug_backtrace() which returns an associative array with the following data: Você também pode usar debug_backtrace () que retorna um array associativo com os seguintes dados:
Possible returned elements from debug_backtrace() Possíveis elementos de devolvidos debug_backtrace ()
| Name Nome | Type Tipo | Description Descrição |
|---|---|---|
| function Função | string string | The current function name. A função actual nome. See also Ver também |
| line | integer integer | The current line number. O número atual linha. See also Ver também __LINE__. |
| file arquivo | string string | The current file name. O actual nome de arquivo. See also Ver também __FILE__. |
| class turma | string string | The current class name. O nome atual classe. See also Ver também |
| type tipo | string string | The current call type. Os actuais tipo de chamada. If a method call, “->” is returned. Se um método chamada, "->" é retornado. If a static Se um estático method call, “::” is returned. Método chamada, "::" é retornado. If a function call, nothing is returned. Se uma chamada de função, nada é retornado. |
| args | array array | If inside a function, this lists the functions arguments. Se dentro de uma função, esta enumera as funções argumentos. If Se |
Filed under Arquivado em Headline News Headline News , How To How To , Java Software Java Software , Open Source Software Open Source Software , PHP , Programming Programação , Tech Note Nota Tech , Web | |
| |
RSS 2.0 RSS 2,0 | |
Trackback this Article | este artigo |
Email this Article E-mail este artigo
You may also like to read Você pode também gosta de ler |




