{"id":3319,"date":"2017-10-23T15:23:56","date_gmt":"2017-10-23T17:23:56","guid":{"rendered":"http:\/\/blog.turbosite.com.br\/?p=3319"},"modified":"2017-10-23T15:23:56","modified_gmt":"2017-10-23T17:23:56","slug":"30-melhores-praticas-em-php-para-iniciantes","status":"publish","type":"post","link":"https:\/\/www.turbosite.com.br\/blog\/30-melhores-praticas-em-php-para-iniciantes\/","title":{"rendered":"30 melhores pr\u00e1ticas em PHP para iniciantes"},"content":{"rendered":"<p>Voltando \u00e0s origens, linguagem PHP, j\u00e1 que ultimamente s\u00f3 tenho publicado aqui no meu site materiais sobre Linux e C\/C++. Esta \u00e9 uma vers\u00e3o em portugu\u00eas do excelente artigo de Glen Stansberry, encontrado originalmente em ingl\u00eas, no seguinte link:\u00a0<a style=\"font-weight: inherit; font-style: inherit; color: #ec8500;\" title=\"Vers\u00e3o Original\" href=\"http:\/\/net.tutsplus.com\/tutorials\/php\/30-php-best-practices-for-beginners\/\" target=\"_blank\" rel=\"noopener\">http:\/\/net.tutsplus.com\/tutorials\/php\/30-php-best-practices-for-beginners\/<\/a>. Acredito que seja muito v\u00e1lido reproduzi-lo aqui traduzido. Dados os devidos cr\u00e9ditos, vamos ao que interessa. PHP \u00e9 a linguagem de programa\u00e7\u00e3o mais utilizada para web do mundo. Aqui est\u00e3o trinta e duas boas e aconselh\u00e1veis pr\u00e1ticas para programadores iniciantes (e tamb\u00e9m para os experientes) que desejam obter uma melhor compreens\u00e3o dos fundamentos.<\/p>\n<p><strong style=\"font-style: inherit;\">1. Seja amigo do manual do PHP<br \/>\n<\/strong>Se voc\u00ea \u00e9 novo em PHP, ent\u00e3o \u00e9 hora de se familiarizar com essa excelente ferramenta que \u00e9 o manual do PHP. O manual PHP \u00e9 extremamente minucioso e tem coment\u00e1rios verdadeiramente \u00fateis seguindo cada artigo. Antes de fazer perguntas ou sair tentando descobrir um problema sozinho, reserve algum tempo e consulte o manual. H\u00e1 probabilidades da resposta \u00e0 sua d\u00favida j\u00e1 est\u00e1 listada em um coment\u00e1rio em um dos artigos no site PHP.net.<\/p>\n<p><strong style=\"font-style: inherit;\">2. Ligue o Error Reporting<br \/>\n<\/strong>O Error Reporting em PHP \u00e9 muito \u00fatil. Voc\u00ea vai encontrar bugs em seu c\u00f3digo que voc\u00ea pode n\u00e3o ter visto antes, j\u00e1 que nem todos os bugs param a execu\u00e7\u00e3o da aplica\u00e7\u00e3o. Voc\u00ea pode usar diferentes n\u00edveis de rigor na informa\u00e7\u00e3o, mas E_ALL ir\u00e1 mostrar-lhe a maioria dos erros, cr\u00edticas e advert\u00eancias. Uma vez que voc\u00ea transferiu sua aplica\u00e7\u00e3o para a produ\u00e7\u00e3o, voc\u00ea obviamente deve desligar o Error Reporting, ou ent\u00e3o os visitantes ir\u00e3o ver erros estranhos que eles n\u00e3o entendem.<\/p>\n<p><strong style=\"font-style: inherit;\">3. Teste uma IDE<br \/>\n<\/strong>IDE \u2013 Integrated Development Environments \u2013 s\u00e3o ferramentas \u00fateis para qualquer desenvolvedor. Uma IDE fornece ferramentas como: * highlighting de sintaxe * autocomplete * alertas de erro * refatora\u00e7\u00e3o (retrabalho) H\u00e1 muitas outras funcionalidades. H\u00e1 muitas IDEs poderosas e com suporte PHP.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"IDE\" src=\"https:\/\/www.turbosite.com.br\/blog\/wp-content\/uploads\/2014\/07\/ide.png\" alt=\"IDE\" width=\"456\" height=\"306\" border=\"0\" \/><\/p>\n<p><strong style=\"font-style: inherit;\">4. Teste um Framework<br \/>\n<\/strong>Voc\u00ea pode aprender muito sobre o PHP apenas testando frameworks. Frameworks como CakePHP ou CodeIgniter permitem-lhe criar rapidamente aplica\u00e7\u00f5es PHP, sem ter que ser um especialista na linguagem. De certa forma, eles s\u00e3o quase como um treino em PHP que mostra o que uma aplica\u00e7\u00e3o deve ter, e mostra-lhe os conceitos de programa\u00e7\u00e3o importantes (como a que separa a l\u00f3gica do design, etc.)<\/p>\n<p><strong style=\"font-style: inherit;\">5. Aprenda sobre DRY<br \/>\n<\/strong>DRY \u2013 Don\u2019t Repeat Yourself(ou simplesmente, n\u00e3o se repita) \u2013 \u00e9 um conceito de programa\u00e7\u00e3o valioso, n\u00e3o importa qual seja a linguagem. Programa\u00e7\u00e3o em DRY, como o nome indica, \u00e9 garantir que voc\u00ea n\u00e3o escreva c\u00f3digo redundante. Aqui est\u00e1 um exemplo de Reinhold Weber:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"DRY\" src=\"https:\/\/www.turbosite.com.br\/blog\/wp-content\/uploads\/2014\/07\/dry.png\" alt=\"DRY\" width=\"456\" height=\"189\" border=\"0\" \/><\/p>\n<p>Este c\u00f3digo\u2026<\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$mysql<\/code> <code style=\"color: black !important;\">= mysql_connect(<\/code><code class=\"php string\" style=\"color: blue !important;\">'localhost'<\/code><code style=\"color: black !important;\">, <\/code><code class=\"php string\" style=\"color: blue !important;\">'reinhold'<\/code><code style=\"color: black !important;\">, <\/code><code class=\"php string\" style=\"color: blue !important;\">'secret_hash'<\/code><code style=\"color: black !important;\">);<\/code><\/div>\n<div style=\"font-weight: inherit; font-style: inherit;\">\n<div class=\"line number2 index1 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">mysql_select_db(<\/code><code class=\"php string\" style=\"color: blue !important;\">'wordpress'<\/code><code style=\"color: black !important;\">) <\/code><code class=\"php keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">or<\/code> <code class=\"php keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">die<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php string\" style=\"color: blue !important;\">\"cannot select DB\"<\/code><code style=\"color: black !important;\">);<\/code><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<p>Agora, com a abordagem DRY\u2026<\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\"><\/div>\n<div style=\"font-weight: inherit; font-style: inherit;\">\n<div class=\"line number1 index0 alt2\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$db_host<\/code> <code style=\"color: black !important;\">= <\/code><code class=\"php string\" style=\"color: blue !important;\">'localhost'<\/code><code style=\"color: black !important;\">;<\/code><\/div>\n<div class=\"line number2 index1 alt1\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$db_user<\/code> <code style=\"color: black !important;\">= <\/code><code class=\"php string\" style=\"color: blue !important;\">'reinhold'<\/code><code style=\"color: black !important;\">;<\/code><\/div>\n<div class=\"line number3 index2 alt2\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$db_password<\/code> <code style=\"color: black !important;\">= <\/code><code class=\"php string\" style=\"color: blue !important;\">'secret_hash'<\/code><code style=\"color: black !important;\">;<\/code><\/div>\n<div class=\"line number4 index3 alt1\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$db_database<\/code> <code style=\"color: black !important;\">= <\/code><code class=\"php string\" style=\"color: blue !important;\">'wordpress'<\/code><code style=\"color: black !important;\">;<\/code><\/div>\n<div class=\"line number5 index4 alt2\" style=\"color: #4b4b4b;\"><code class=\"php spaces\">\u00a0<\/code><\/div>\n<div class=\"line number6 index5 alt1\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$mysql<\/code> <code style=\"color: black !important;\">= mysql_connect(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$db_host<\/code><code style=\"color: black !important;\">, <\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$db_user<\/code><code style=\"color: black !important;\">, <\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$db_password<\/code><code style=\"color: black !important;\">);<\/code><\/div>\n<div class=\"line number7 index6 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">mysql_select_db(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$db_database<\/code><code style=\"color: black !important;\">);<\/code><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<p><strong style=\"font-style: inherit;\"><br \/>\n6. Indente seu c\u00f3digo e use espa\u00e7os em branco para melhor uma legibilidade<br \/>\n<\/strong> <span style=\"font-weight: inherit; font-style: inherit;\">Se voc\u00ea n\u00e3o usa identa\u00e7\u00f5es e espa\u00e7os em branco no seu c\u00f3digo, o resultado parece uma pintura de Jackson Pollack.<\/span>\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">Garanta que seu c\u00f3digo seja leg\u00edvel e f\u00e1cil de pesquisar, assim ser\u00e1 mais f\u00e1cil alter\u00e1-lo no futuro.<\/span>\u00a0<span style=\"font-weight: inherit; font-style: inherit;\">IDEs e editores avan\u00e7ados geralmente adicionam recuos automaticamente.<\/span><\/p>\n<p><strong style=\"font-style: inherit;\">7. Organize seu c\u00f3digo em camadas<br \/>\n<\/strong> Organizar seus aplicativos em camadas, nada mais \u00e9 do que separar os diferentes componentes do c\u00f3digo em diferentes partes. Isso permite que voc\u00ea altere seu c\u00f3digo facilmente no futuro. No site NETTUTS, Jason Lengstorf escreveu um excelente artigo sobre, como organizar sua aplica\u00e7\u00e3o PHP em camadas pode facilitar a manuten\u00e7\u00e3o.<\/p>\n<p><strong style=\"font-style: inherit;\">8. Use sempre &lt;?php ?&gt;<br \/>\n<\/strong> Muitas vezes os programadores tentam encurtar ou substituir a tag PHP. Aqui est\u00e3o alguns exemplos mais comuns:<\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\">\n<div class=\"line number1 index0 alt2\"><code style=\"color: black !important;\">&lt;?<\/code><code><span style=\"color: #4b4b4b;\">\u00a0<\/span><\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">echo<\/code> <code class=\"php string\" style=\"color: blue !important;\">\"Hello world\"<\/code><code style=\"color: black !important;\">;\u00a0<\/code>?&gt;<\/div>\n<div class=\"line number4 index3 alt1\" style=\"color: #4b4b4b;\"><\/div>\n<div class=\"line number5 index4 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;?=<\/code><code class=\"php string\" style=\"color: blue !important;\">\"Hello world\"<\/code><code style=\"color: black !important;\">; ?&gt;<\/code><\/div>\n<div class=\"line number7 index6 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;% <\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">echo<\/code> <code class=\"php string\" style=\"color: blue !important;\">\"Hello world\"<\/code><code style=\"color: black !important;\">; %&gt;<\/code><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<p><strong style=\"font-style: inherit;\"><br \/>\n9. Use uma conven\u00e7\u00e3o de nomes consistente e significativa<br \/>\n<\/strong>Isto n\u00e3o \u00e9 apenas para seu pr\u00f3prio bem. N\u00e3o h\u00e1 nada pior do que tentar encontrar o significado em algumas conven\u00e7\u00e3o de nomes sem sentido de outros programadores. Ajude a si e aos outros utilizando nomes que tenham sentido para suas classes e fun\u00e7\u00f5es.<\/p>\n<p><strong style=\"font-style: inherit;\">10. Sempre utilize coment\u00e1rios<\/strong><br \/>\nAl\u00e9m de usar espa\u00e7os em branco e indenta\u00e7\u00f5es, voc\u00ea tamb\u00e9m deve usar coment\u00e1rios para documentar e organizar o seu c\u00f3digo. Voc\u00ea vai agradecer a si mesmo mais tarde, quando precisar encontrar alguma coisa num c\u00f3digo antigo, ou mesmo se voc\u00ea simplesmente n\u00e3o lembrar o que faz determinada fun\u00e7\u00e3o. Ser\u00e1 \u00fatil tamb\u00e9m para qualquer pessoa que precise analisar seu c\u00f3digo.<\/p>\n<p><strong style=\"font-style: inherit;\">11. Use MAMP\/WAMP<br \/>\n<\/strong> MySQL \u00e9 o mais popular gerenciador de banco de dados usado com PHP (embora n\u00e3o seja o \u00fanico). Se voc\u00ea est\u00e1 querendo criar um ambiente local para desenvolver e testar suas aplica\u00e7\u00f5es, procure instalar o MAMP (Mac) ou WAMP (Windows). Instalar o MySQL na unha pode ser um processo tedioso, e ambos os pacotes de software s\u00e3o completos(Apache, PHP e MySQL) e instalam tudo de uma s\u00f3 vez.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"MAMP\" src=\"https:\/\/www.turbosite.com.br\/blog\/wp-content\/uploads\/2014\/07\/mamp.png\" alt=\"MAMP\" width=\"334\" height=\"193\" border=\"0\" \/><\/p>\n<p><strong style=\"font-style: inherit;\">12. D\u00ea limites aos seus scripts<br \/>\n<\/strong> Colocar um limite de tempo em seus scripts PHP \u00e9 uma coisa muito perigosa. Haver\u00e1 momentos em que seus scripts iram falhar, e quando o falharem, voc\u00ea vai querer usar a fun\u00e7\u00e3o set_time_limit para evitar loops infinitos e estouro de tempo limite da conex\u00e3o de dados. A fun\u00e7\u00e3o set_time_limit coloca um limite de tempo em segundos para a execu\u00e7\u00e3o de um script (o padr\u00e3o \u00e9 30). Se o script ultrapassar esse limite em execu\u00e7\u00e3o, um erro fatal ser\u00e1 acionado.<\/p>\n<p><strong style=\"font-style: inherit;\">13. Use objetos (ou POO)<\/strong><br \/>\nPrograma\u00e7\u00e3o orientada a objetos (POO) usa objetos para representar partes da aplica\u00e7\u00e3o. N\u00e3o \u00e9 apenas uma maneira de quebrar o c\u00f3digo em partes, mas tamb\u00e9m reduz a repeti\u00e7\u00e3o de c\u00f3digo e torna muito mais f\u00e1cil a manuten\u00e7\u00e3o.<\/p>\n<p><strong style=\"font-style: inherit;\">14. Saiba a diferen\u00e7a entre as simples e duplas<br \/>\n<\/strong> \u00c9 mais eficiente usar aspas simples em strings quando o analisador n\u00e3o tiver que passar pelo crivo de olhar para caracteres de escape e outras coisas que as aspas duplas permitem. Sempre que poss\u00edvel, use aspas simples.<\/p>\n<p><strong style=\"font-style: inherit;\">15. N\u00e3o coloque phpinfo() no seu webroot<br \/>\n<\/strong> Phpinfo() \u00e9 uma coisa bonita. \u00c9 facilmente criada com apenas a linha abaixo: &lt;?php phpinfo(); ?&gt; e colocando-o em algum lugar do seu servidor, voc\u00ea pode imediatamente saber tudo sobre as configura\u00e7\u00f5es do mesmo. Por\u00e9m, muitos novatos colocam um arquivo com phpinfo() no webroot do servidor de hospedagem. Esta \u00e9 uma falha de seguran\u00e7a, pois se esta p\u00e1gina for visualizada por qualquer um, ela poder\u00e1 significar a ru\u00edna do seu servidor. Certifique-se que o phpinfo() est\u00e1 em um local seguro, e sempre use este procedimento, exclua-o assim que n\u00e3o precisar mais dele.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"phpinfo\" src=\"https:\/\/www.turbosite.com.br\/blog\/wp-content\/uploads\/2014\/07\/phpinfo.png\" alt=\"phpinfo\" width=\"451\" height=\"199\" border=\"0\" \/><\/p>\n<p><strong style=\"font-style: inherit;\">16. Nunca diga toda a verdade a seus usu\u00e1rios<br \/>\n<\/strong>Se seu aplicativo tem um formul\u00e1rio de login, voc\u00ea deve sempre assumir que eles v\u00e3o tentar introduzir c\u00f3digos maliciosos. (N\u00e3o estou sugerindo que seus usu\u00e1rios s\u00e3o pessoas m\u00e1s. \u00c9 apenas uma boa pr\u00e1tica utilizar esta mentalidade.) Uma \u00f3tima maneira de manter o seu site protegido de hackers \u00e9 sempre inicializar suas vari\u00e1veis para proteger o seu site de ataques XSS. No PHP.net tem um exemplo de um formul\u00e1rio devidamente protegido com vari\u00e1veis inicializadas:<\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\">\n<div class=\"line number1 index0 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;?php<\/code><\/div>\n<div class=\"line number2 index1 alt1\" style=\"color: #4b4b4b;\"><code class=\"php keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">if<\/code> <code style=\"color: black !important;\">(correct_user(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$_POST<\/code><code style=\"color: black !important;\">[<\/code><code class=\"php string\" style=\"color: blue !important;\">'user'<\/code><code style=\"color: black !important;\">], <\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$_POST<\/code><code style=\"color: black !important;\">[<\/code><code class=\"php string\" style=\"color: blue !important;\">'password'<\/code><code style=\"color: black !important;\">]) {<\/code><\/div>\n<div class=\"line number3 index2 alt2\" style=\"color: #4b4b4b;\"><code class=\"php spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$login<\/code> <code style=\"color: black !important;\">= true;<\/code><\/div>\n<div class=\"line number4 index3 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">}<\/code><\/div>\n<div class=\"line number5 index4 alt2\" style=\"color: #4b4b4b;\"><\/div>\n<div class=\"line number6 index5 alt1\" style=\"color: #4b4b4b;\"><code class=\"php keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">if<\/code> <code style=\"color: black !important;\">(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$login<\/code><code style=\"color: black !important;\">) {<\/code><\/div>\n<div class=\"line number7 index6 alt2\" style=\"color: #4b4b4b;\"><code class=\"php spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code style=\"color: black !important;\">forward_to_secure_environment();<\/code><\/div>\n<div class=\"line number8 index7 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">}<\/code><\/div>\n<div class=\"line number9 index8 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">?&gt;<\/code><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<p><strong style=\"font-style: inherit;\"><br \/>\n17. Armazene senhas criptografadas<br \/>\n<\/strong>Muitos novatos PHP frequentemente guardam dados importantes, como senhas no banco de dados sem aplicar qualquer criptografia. Considere usar MD5 para criptografar senhas antes de guarda-las em um banco de dados. <code class=\"php functions\" style=\"color: #ff1493 !important;\">echo\u00a0<\/code><code style=\"color: black !important;\">md5(<\/code><code class=\"php string\" style=\"color: blue !important;\">'myPassword'<\/code><code style=\"color: black !important;\">); <\/code><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ renders - deb1536f480475f7d593219aa1afd74c<\/code><\/p>\n<p><strong style=\"font-style: inherit;\">18. Use uma ferramenta gr\u00e1fica para modelar banco de dados<br \/>\n<\/strong>Se voc\u00ea est\u00e1 encontrando dificuldades para modelar e alterar as bases de dados de suas aplica\u00e7\u00f5es, voc\u00ea pode pensar em usar uma ferramenta gr\u00e1fica. Usu\u00e1rios do MySQL podem trabalhar com DBDesigner e MySQL Workbench para projetar visualmente seus bancos de dados.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Workbench\" src=\"https:\/\/www.turbosite.com.br\/blog\/wp-content\/uploads\/2014\/07\/workbench.png\" alt=\"Workbench\" width=\"387\" height=\"210\" border=\"0\" \/><\/p>\n<p><strong style=\"font-style: inherit;\">19. Use um buffer de saida<br \/>\n<\/strong> Buffer de sa\u00edda \u00e9 uma maneira simples de melhorar consideravelmente o desempenho e a velocidade do seu script PHP. Sem buffer de sa\u00edda, o script ir\u00e1 mostrar o c\u00f3digo HTML da p\u00e1gina como \u00e9 processado \u2013 em peda\u00e7os. Adicionar um buffer de sa\u00edda permitir\u00e1 que o PHP armazene o HTML como uma vari\u00e1vel e a envie para o navegador de uma vez. Para ativar o buffer de sa\u00edda, basta adicionar ob_start() no topo do arquivo.<\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\">\n<div class=\"line number1 index0 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;!DOCTYPE html&gt;<\/code><\/div>\n<div class=\"line number2 index1 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;?php ob_start(<\/code><code class=\"php string\" style=\"color: blue !important;\">'ob_gzhandler'<\/code><code style=\"color: black !important;\">); ?&gt;<\/code><\/div>\n<div class=\"line number3 index2 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;html lang=<\/code><code class=\"php string\" style=\"color: blue !important;\">\"en\"<\/code><code style=\"color: black !important;\">&gt;<\/code><\/div>\n<div class=\"line number4 index3 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;head&gt;<\/code><\/div>\n<div class=\"line number5 index4 alt2\" style=\"color: #4b4b4b;\"><code class=\"php spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code style=\"color: black !important;\">&lt;meta http-equiv=<\/code><code class=\"php string\" style=\"color: blue !important;\">\"Content-Type\"<\/code> <code style=\"color: black !important;\">content=<\/code><code class=\"php string\" style=\"color: blue !important;\">\"text\/html; charset=utf-8\"<\/code><code style=\"color: black !important;\">&gt; <\/code><\/div>\n<div class=\"line number6 index5 alt1\" style=\"color: #4b4b4b;\"><code class=\"php spaces\">\u00a0\u00a0\u00a0\u00a0<\/code><code style=\"color: black !important;\">&lt;title&gt;untitled&lt;\/title&gt;<\/code><\/div>\n<div class=\"line number7 index6 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;\/head&gt;<\/code><\/div>\n<div class=\"line number8 index7 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;body&gt;<\/code><\/div>\n<div class=\"line number9 index8 alt2\" style=\"color: #4b4b4b;\"><code class=\"php spaces\">\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><\/div>\n<div class=\"line number10 index9 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;\/body&gt;<\/code><\/div>\n<div class=\"line number11 index10 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;\/html&gt;<\/code><\/div>\n<div class=\"line number12 index11 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">&lt;?php ob_end_flush(); ?&gt;<\/code><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<p><strong style=\"font-style: inherit;\"><br \/>\n20. Proteja seu script de SQL injection<br \/>\n<\/strong> Se voc\u00ea n\u00e3o escapa os caracteres utilizados em strings SQL, seu c\u00f3digo \u00e9 vulner\u00e1vel a SQL injection. Voc\u00ea pode evitar isso usando os mysql_real_escape_string, ou usando as declara\u00e7\u00f5es preparadas. Aqui est\u00e1 um exemplo de mysql_real_escape_string em a\u00e7\u00e3o:<\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\"><\/div>\n<div style=\"font-weight: inherit; font-style: inherit;\">\n<table class=\"crayon-table\" style=\"font-weight: inherit; font-style: inherit;\">\n<tbody style=\"font-weight: inherit; font-style: inherit;\">\n<tr class=\"crayon-row\" style=\"font-weight: inherit; font-style: inherit;\">\n<td class=\"crayon-nums \" style=\"font-style: inherit; color: #afafaf !important;\" data-settings=\"show\">\n<div class=\"crayon-nums-content\" style=\"font-weight: inherit; font-style: inherit;\">\n<div class=\"crayon-num\" style=\"font-weight: inherit !important; font-style: inherit;\" data-line=\"crayon-53d8e4eaa6ac0321336637-1\">1<\/div>\n<\/div>\n<\/td>\n<td class=\"crayon-code\" style=\"font-style: inherit;\">\n<div class=\"crayon-pre\" style=\"font-weight: inherit; font-style: inherit;\">\n<div id=\"crayon-53d8e4eaa6ac0321336637-1\" class=\"crayon-line\" style=\"font-weight: inherit !important; font-style: inherit;\"><span class=\"crayon-sy\" style=\"font-weight: inherit !important; font-style: inherit; color: #333333 !important;\">$<\/span><span class=\"crayon-v\" style=\"font-weight: inherit !important; font-style: inherit; color: #002d7a !important;\">username<\/span><span class=\"crayon-o\" style=\"font-weight: inherit !important; font-style: inherit; color: #006fe0 !important;\">=<\/span><span class=\"crayon-e\" style=\"font-weight: inherit !important; font-style: inherit; color: #004ed0 !important;\">mysql_real_escape_string<\/span><span class=\"crayon-sy\" style=\"font-weight: inherit !important; font-style: inherit; color: #333333 !important;\">(<\/span><span class=\"crayon-sy\" style=\"font-weight: inherit !important; font-style: inherit; color: #333333 !important;\">$<\/span><span class=\"crayon-v\" style=\"font-weight: inherit !important; font-style: inherit; color: #002d7a !important;\">GET<\/span><span class=\"crayon-sy\" style=\"font-weight: inherit !important; font-style: inherit; color: #333333 !important;\">[<\/span><span class=\"crayon-s\" style=\"font-weight: inherit !important; font-style: inherit; color: #008000 !important;\">&#8216;username&#8217;<\/span><span class=\"crayon-sy\" style=\"font-weight: inherit !important; font-style: inherit; color: #333333 !important;\">]<\/span><span class=\"crayon-sy\" style=\"font-weight: inherit !important; font-style: inherit; color: #333333 !important;\">)<\/span><span class=\"crayon-sy\" style=\"font-weight: inherit !important; font-style: inherit; color: #333333 !important;\">;<\/span><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>e em uma declara\u00e7\u00e3o preparada:<\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$id<\/code> <code style=\"color: black !important;\">= <\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$_GET<\/code><code style=\"color: black !important;\">[<\/code><code class=\"php string\" style=\"color: blue !important;\">'id'<\/code><code style=\"color: black !important;\">];<\/code><\/div>\n<\/div>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\">\n<div class=\"line number2 index1 alt1\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$statement<\/code> <code style=\"color: black !important;\">= <\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$connection<\/code><code style=\"color: black !important;\">-&gt;prepare( <\/code><code class=\"php string\" style=\"color: blue !important;\">\"SELECT * FROM tbl_members WHERE id = ?\"<\/code> <code style=\"color: black !important;\">);<\/code><\/div>\n<div class=\"line number3 index2 alt2\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$statement<\/code><code style=\"color: black !important;\">-&gt;bind_param( <\/code><code class=\"php string\" style=\"color: blue !important;\">\"i\"<\/code><code style=\"color: black !important;\">, <\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$id<\/code> <code style=\"color: black !important;\">);<\/code><\/div>\n<div class=\"line number4 index3 alt1\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$statement<\/code><code style=\"color: black !important;\">-&gt;execute();<\/code><\/div>\n<\/div>\n<\/div>\n<p><strong style=\"font-style: inherit;\"><br \/>\n21. Teste ORM<br \/>\n<\/strong> Se voc\u00ea usa o conceito de object-oriented em PHP, ent\u00e3o voc\u00ea pode usar a eleg\u00e2ncia de um objeto de mapeamento relacional (ORM). Um ORM permite converter dados entre bancos de dados relacionais e objeto-linguagens de programa\u00e7\u00e3o orientada. Em suma: um ORM permite que voc\u00ea trabalhe com bases de dados da mesma maneira que voc\u00ea trabalha com classes e objetos no PHP. H\u00e1 uma abund\u00e2ncia de bibliotecas ORM para PHP como o Propel, e tamb\u00e9m constru\u00e7\u00f5es em frameworks como o CakePHP.<\/p>\n<p><strong style=\"font-style: inherit;\">22. Cache de dados orientado \u00e0 p\u00e1ginas<br \/>\n<\/strong> Cache de dados orientado \u00e0 p\u00e1ginas PHP \u00e9 uma excelente id\u00e9ia para melhorar a carga e performance do seu script. N\u00e3o \u00e9 t\u00e3o dif\u00edcil de criar e recuperar arquivos de conte\u00fado est\u00e1tico, com a ajuda do nosso bom amigo ob_start(). Aqui est\u00e1 um exemplo retirado da Snipe.net: <span style=\"font-weight: inherit; font-style: inherit; color: #008000;\">\/\/ No topo do script<\/span><\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\">\n<div class=\"line number2 index1 alt1\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$cachefile<\/code> <code style=\"color: black !important;\">= <\/code><code class=\"php string\" style=\"color: blue !important;\">'cache\/'<\/code><code style=\"color: black !important;\">.<\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">basename<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$_SERVER<\/code><code style=\"color: black !important;\">[<\/code><code class=\"php string\" style=\"color: blue !important;\">'SCRIPT_URI'<\/code><code style=\"color: black !important;\">]);<\/code><\/div>\n<div class=\"line number3 index2 alt2\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$cachetime<\/code> <code style=\"color: black !important;\">= 120 * 60; <\/code><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ 2 hours<\/code><\/div>\n<div class=\"line number4 index3 alt1\" style=\"color: #4b4b4b;\"><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ Serve from the cache if it is younger than $cachetime<\/code><\/div>\n<div class=\"line number5 index4 alt2\" style=\"color: #4b4b4b;\"><code class=\"php keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">if<\/code> <code style=\"color: black !important;\">(<\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">file_exists<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$cachefile<\/code><code style=\"color: black !important;\">) &amp;&amp; (time() - <\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$cachetime<\/code> <code style=\"color: black !important;\">&lt; <\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">filemtime<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$cachefile<\/code><code style=\"color: black !important;\">))) {<\/code><\/div>\n<div class=\"line number6 index5 alt1\" style=\"color: #4b4b4b;\"><code class=\"php keyword\" style=\"font-weight: bold !important; color: #006699 !important;\">include<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$cachefile<\/code><code style=\"color: black !important;\">);<\/code><\/div>\n<div class=\"line number7 index6 alt2\" style=\"color: #4b4b4b;\"><code class=\"php functions\" style=\"color: #ff1493 !important;\">echo<\/code> <code class=\"php string\" style=\"color: blue !important;\">\"&lt;!-- Cached \"<\/code><code style=\"color: black !important;\">.<\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">date<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php string\" style=\"color: blue !important;\">'jS F Y H:i'<\/code><code style=\"color: black !important;\">, <\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">filemtime<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$cachefile<\/code><code style=\"color: black !important;\">)).<\/code><code class=\"php string\" style=\"color: blue !important;\">\" --&gt;\"<\/code><code style=\"color: black !important;\">;<\/code><\/div>\n<div class=\"line number8 index7 alt1\" style=\"color: #4b4b4b;\"><code class=\"php functions\" style=\"color: #ff1493 !important;\">exit<\/code><code style=\"color: black !important;\">;<\/code><\/div>\n<div class=\"line number9 index8 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">}<\/code><\/div>\n<div class=\"line number10 index9 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">ob_start(); <\/code><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ start the output buffer<\/code><\/div>\n<div class=\"line number11 index10 alt2\" style=\"color: #4b4b4b;\"><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ Your normal PHP script and HTML content here<\/code><\/div>\n<div class=\"line number12 index11 alt1\" style=\"color: #4b4b4b;\"><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ BOTTOM of your script<\/code><\/div>\n<div class=\"line number13 index12 alt2\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$fp<\/code> <code style=\"color: black !important;\">= <\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">fopen<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$cachefile<\/code><code style=\"color: black !important;\">, <\/code><code class=\"php string\" style=\"color: blue !important;\">'w'<\/code><code style=\"color: black !important;\">); <\/code><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ open the cache file for writing<\/code><\/div>\n<div class=\"line number14 index13 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">fwrite(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$fp<\/code><code style=\"color: black !important;\">, ob_get_contents()); <\/code><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ save the contents of output buffer to the file<\/code><\/div>\n<div class=\"line number15 index14 alt2\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">fclose(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$fp<\/code><code style=\"color: black !important;\">); <\/code><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ close the file<\/code><\/div>\n<div class=\"line number16 index15 alt1\" style=\"color: #4b4b4b;\"><code style=\"color: black !important;\">ob_end_flush(); <\/code><code class=\"php comments\" style=\"color: #008200 !important;\">\/\/ Send the output to the browser<\/code><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<p>Este bloco de c\u00f3digo ir\u00e1 utilizar uma vers\u00e3o em cache de uma p\u00e1gina que est\u00e1 guardada a menos de 2 horas.<\/p>\n<p><strong style=\"font-style: inherit;\">23. Use um sistema de cache<br \/>\n<\/strong> Se voc\u00ea est\u00e1 querendo um sistema de cache mais robusto, h\u00e1 uma cache de scripts PHP que na opini\u00e3o de muitos \u00e9 mais completo do que o exemplo acima. * Memcached * APC * XCache * Zend Cache * eAccelerator.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"Memcached\" src=\"https:\/\/www.turbosite.com.br\/blog\/wp-content\/uploads\/2014\/07\/memcached.png\" alt=\"Memcached\" width=\"437\" height=\"153\" border=\"0\" \/><\/p>\n<p><strong style=\"font-style: inherit;\">24. Validar dados de cookies<br \/>\n<\/strong>Os dados de cookies, como todos os dados que trafegam na Web, podem ser prejudicial. Voc\u00ea pode ent\u00e3o, validar os dados de cookies, tanto atrav\u00e9s da fun\u00e7\u00e3o htmlspecialchars(), como tamb\u00e9m com, mysql_real_escape_string ().<\/p>\n<p><strong style=\"font-style: inherit;\">25. Use um sistema de cache de arquivos<br \/>\n<\/strong>Al\u00e9m de usar um cache do banco de dados do sistemas como cache de mem\u00f3ria, voc\u00ea tamb\u00e9m pode querer experimentar um sistema de templates para aumentar o desempenho em suas aplica\u00e7\u00f5es PHP. O Smarty \u00e9 um sistema robusto de templates e tem cache incorporada.<\/p>\n<p><strong style=\"font-style: inherit;\">26. Depure seu c\u00f3digo<br \/>\n<\/strong>Depurar seu c\u00f3digo com uma ferramenta como o Xdebug pode ajudar a detectar rapidamente gargalos e outros problemas potenciais em seu c\u00f3digo. Algumas IDE\u2019s como o Netbeans, tamb\u00e9m possuem funcionalidades de debug.<\/p>\n<p><strong style=\"font-style: inherit;\">27. Padr\u00e3o de codifica\u00e7\u00e3o<br \/>\n<\/strong>Uma vez que voc\u00ea tenha aprendido o essencial do PHP, voc\u00ea pode come\u00e7ar a aprender tamb\u00e9m sobre um padr\u00e3o de codifica\u00e7\u00e3o. Existem diferentes padr\u00f5es(por exemplo Zend e PEAR), e come\u00e7ar a trabalhar com um deles vai ajud\u00e1-lo com a consist\u00eancia de sua codifica\u00e7\u00e3o \u00e0 longo prazo.<\/p>\n<p><strong style=\"font-style: inherit;\">28. N\u00e3o use fun\u00e7\u00f5es dentro de loops<br \/>\n<\/strong> Sua aplica\u00e7\u00e3o perde performance quando voc\u00ea inclui fun\u00e7\u00f5es dentro de loops. Quanto maior o loop que voc\u00ea tem, maior o tempo de execu\u00e7\u00e3o.<\/p>\n<p><strong style=\"font-style: inherit;\">29. N\u00e3o crie vari\u00e1veis extras<br \/>\n<\/strong>Algumas pessoas gostam de experimentar e tornar seu c\u00f3digo mais atraente, colocando o conte\u00fado de vari\u00e1veis pr\u00e9-definidas em outras vari\u00e1veis. Isto \u00e9 redund\u00e2ncia e pode dobrar o consumo de mem\u00f3ria. Google Code tem maus e bons exemplos de uso de vari\u00e1vel: Errado<\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\">\n<div class=\"line number1 index0 alt2\" style=\"color: #4b4b4b;\"><code class=\"php variable\" style=\"color: #aa7700 !important;\">$description<\/code> <code style=\"color: black !important;\">= <\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">strip_tags<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$_POST<\/code><code style=\"color: black !important;\">[<\/code><code class=\"php string\" style=\"color: blue !important;\">'description'<\/code><code style=\"color: black !important;\">]);<\/code><\/div>\n<div class=\"line number2 index1 alt1\" style=\"color: #4b4b4b;\"><code class=\"php functions\" style=\"color: #ff1493 !important;\">echo<\/code> <code class=\"php variable\" style=\"color: #aa7700 !important;\">$description<\/code><code style=\"color: black !important;\">;<\/code><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<p>Correto<\/p>\n<div>\n<div style=\"font-weight: inherit; font-style: inherit;\"><code class=\"php functions\" style=\"color: #ff1493 !important;\">echo\u00a0<\/code><code class=\"php functions\" style=\"color: #ff1493 !important;\">strip_tags<\/code><code style=\"color: black !important;\">(<\/code><code class=\"php variable\" style=\"color: #aa7700 !important;\">$_POST<\/code><code style=\"color: black !important;\">[<\/code><code class=\"php string\" style=\"color: blue !important;\">'description'<\/code><code style=\"color: black !important;\">]);<\/code><\/div>\n<\/div>\n<p><strong style=\"font-style: inherit;\"><br \/>\n30. Sempre use a mais atual vers\u00e3o do PHP<br \/>\n<\/strong>Enquanto isso parece ser uma coisa do senso comum, muitas pessoas n\u00e3o atualizam o PHP. H\u00e1 grande diferen\u00e7a de desempenho entre as vers\u00f5es 4 e 5 do PHP. Verifique se seu servidor est\u00e1 atualizado.<\/p>\n<p><strong style=\"font-style: inherit;\">31. Reduza a quantidade de consultas ao banco de dados<br \/>\n<\/strong>Se voc\u00ea pude enxugar ao m\u00e1ximo o n\u00famero de consultas ao banco de dados, a performance do seu script PHP ir\u00e1 melhorar. Existem ferramentas como Stace (Unix) e Process Explorer (Windows) que lhe permitem encontrar processos redundantes e como voc\u00ea pode combin\u00e1-los.<\/p>\n<p>Compartilhe com seus amigos programadores, fa\u00e7a sua parte e mantenha seus sistemas sempre atualizados e seguros.<\/p>\n<p><strong>Quer um servidor de Hospedagem seguro? Com Firewall? Sistema de Detec\u00e7\u00e3o de Intrus\u00e3o? Contrate um plano de Hospedagem da Turbosite. Servidores ultra r\u00e1pidos e com seguran\u00e7a de \u00faltima gera\u00e7\u00e3o. <a title=\"Turbosite Hospedagem de Sites\" href=\"https:\/\/www.turbosite.com.br\/hospedagem-de-sites\">Clique aqui!<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Voltando \u00e0s origens, linguagem PHP, j\u00e1 que ultimamente s\u00f3 tenho publicado aqui no meu site materiais sobre Linux e C\/C++. Esta \u00e9 uma vers\u00e3o em portugu\u00eas do excelente\u2026<\/p>\n","protected":false},"author":1,"featured_media":3339,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6],"tags":[122,193,485],"class_list":["post-3319","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-desenvolvimento","category-dicas","tag-como-programar-em-php","tag-dicas-php","tag-php"],"_links":{"self":[{"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/posts\/3319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/comments?post=3319"}],"version-history":[{"count":0,"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/posts\/3319\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/media\/3339"}],"wp:attachment":[{"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/media?parent=3319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/categories?post=3319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.turbosite.com.br\/blog\/wp-json\/wp\/v2\/tags?post=3319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}