$xml = simplexml_load_string($string);print_r($xml);
在服务器运行报500错误,
回复讨论(解决方案)
echo 1;$xml = simplexml_load_string($string);print_r($xml);
如果前面加个输出 就不报500,可以输出1;
请问该怎么解决?
$string 是什么?
$string 是什么?
<?php$string = <<<XML<?xml version='1.0'?><document> <title>Forty What?</title> <from>Joe</from> <to>Jane</to> <body> I know that's the answer -- but what's the question? </body></document>XML;echo 1;$xml = simplexml_load_string($string);print_r($xml);大神刚才搜资料 记得您回答过这个问题~
无论如何,调试时是一定要打开 php 的错误显示功能的(别自己个自己找麻烦)
也不要屏蔽任何错误检查
$string 是什么?
这是服务器上php的扩展,
我在本地代码是没有问题的,传服务器就有问题,
服务器php版本是7 本地是5.6
无论如何,调试时是一定要打开 php 的错误显示功能的(别自己个自己找麻烦)
也不要屏蔽任何错误检查
请问是这个吗?
我用的是phpstorm 刚才把检查错误都打开了,没有报错误。
无论如何,调试时是一定要打开 php 的错误显示功能的(别自己个自己找麻烦)
也不要屏蔽任何错误检查
我觉得可能是我服务器哪里配置有问题,可是又不知道从哪下手。
当然时可能的,但总是要看到错误信息才能有针对性的处理
当然时可能的,但总是要看到错误信息才能有针对性的处理
我把php.ini 里面的display_errors设成On了,页面还是报500错误,没有打印错误
当然时可能的,但总是要看到错误信息才能有针对性的处理
知道问题了,报错说 找不到这个方法
无论如何,调试时是一定要打开 php 的错误显示功能的(别自己个自己找麻烦)
也不要屏蔽任何错误检查
我觉得可能是我服务器哪里配置有问题,可是又不知道从哪下手。
刚才考虑是不是SimpleXML 扩展库的问题,查了一下SimpleXML 是php的内置扩展,应该不需要配置吧。
php7 是有的 http://php.net/manual/zh/function.simplexml-load-string.php
看看是否拼写错误
php7 是有的 http://php.net/manual/zh/function.simplexml-load-string.php
看看是否拼写错误
首先我用php -m 看一下php加载的模块
有SimpleXML
然后 我检查是不是拼写错误,拼写没问题
还是报错
这会是什么原因造成的呢?
php7 是有的 http://php.net/manual/zh/function.simplexml-load-string.php
看看是否拼写错误
这是环境版本
你用纯文本方式将那行代码再打一遍
最好不要在 IDE 里打,至少是关闭输入法(最近看到好多代码错是编辑器造成的)
你用纯文本方式将那行代码再打一遍
最好不要在 IDE 里打,至少是关闭输入法(最近看到好多代码错是编辑器造成的)
我把服务器,php-fpm,nginx 重启了下 可以了,非常感谢您!

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Notepad++7.3.1
Easy-to-use and free code editor
