关于变量警告的问题。
2.php的代码是
$xx=123;
3.php的代码是
require '2.php';
echo $xx;
可以输出变量$xx;
但我把3.php的代码改成
require dirname(__FILE__).'/2.php';
echo $xx;
一样可以输出123,但变量$xx显示出警告undefined variable '$xx'
这是什么原因了,是不是因为第二次引用文件时绝对路径的原因,如何去除警告。
------解决方案--------------------
- PHP code
echo dirname(_FILE_).'/2.php'; //看看输出的路径是否正确。<br><font color="#e78608">------解决方案--------------------</font><br>这就是全部代码? 感觉没有错误呀。<br><font color="#e78608">------解决方案--------------------</font><br>一定漏了什么<br><br>没定义怎么输出123?<br><font color="#e78608">------解决方案--------------------</font><br>根据你的思路我测试了 <br>require dirname(__FILE__).'/2.php'; <br>我的是有问题的<br>Warning: require(/usr/web/seaboat/XXX.php) [function.require]: failed to open stream: No such file or directory in /usr/web/seaboat/htdocs/XXX.php on line 19<br><br>Fatal error: require() [function.require]: Failed opening required '/usr/web/seaboat/XXX.php' (include_path='.:/usr/share/pear:/usr/local/lib/Smarty/libs:/usr/web/seaboat/htdocs') in /usr/web/seaboat/htdocs/XX.php on line 19<div class="clear"> </div>

TheBesteptroachForendingeMailsInphPisusingThephPmailerlibraryDuetoitsReliability, featurerichness 및 reaseofuse.phpmailersupportssmtp, proversDetailErrorHandling, supportSattachments, andenhancessecurity.foroptimalu

의존성 주입 (DI)을 사용하는 이유는 코드의 느슨한 커플 링, 테스트 가능성 및 유지 관리 가능성을 촉진하기 때문입니다. 1) 생성자를 사용하여 종속성을 주입하고, 2) 서비스 로케이터 사용을 피하고, 3) 종속성 주입 컨테이너를 사용하여 종속성을 관리하고, 4) 주입 종속성을 통한 테스트 가능성을 향상 시키십시오.

phpperformancetuningiscrucialbecauseitenhancesspeedandefficies, thearevitalforwebapplications.1) cachingsdatabaseloadandimprovesResponsetimes.2) 최적화 된 databasequerieseiesecessarycolumnsingpeedsupedsupeveval.

theBestPracticesForendingEmailsSecurelyPinphPinclude : 1) usingecureconfigurations와 whithsmtpandstarttlSencryption, 2) 검증 및 inputSpreverventInseMeStacks, 3) 암호화에 대한 암호화와 비도시를 확인합니다

tooptimizephPapplicationsperperperperperperperperperferferferferferferferferferferperferferperferperperferferfercations.1) ubsicationScachingwithApcuTeDucedAtaFetchTimes.2) 최적화 된 ABASEABASES.3)

expendencyInphpisaDesignpatternpattern thatenhances-flexibility, testability 및 maintainabilitable externaldenciestoclasses.itallowsforloosecoupling, easiertesting throughmocking 및 modulardesign, berrequirecarefultructuringtoavoid-inje

PHP 성능 최적화는 다음 단계를 통해 달성 할 수 있습니다. 1) 스크립트 상단에 require_once 또는 include_once를 사용하여 파일로드 수를 줄입니다. 2) 데이터베이스 쿼리 수를 줄이기 위해 전처리 문 및 배치 처리를 사용하십시오. 3) Opcode 캐시에 대한 Opcache 구성; 4) PHP-FPM 최적화 프로세스 관리를 활성화하고 구성합니다. 5) CDN을 사용하여 정적 자원을 배포합니다. 6) 코드 성능 분석을 위해 Xdebug 또는 Blackfire를 사용하십시오. 7) 배열과 같은 효율적인 데이터 구조를 선택하십시오. 8) 최적화 실행을위한 모듈 식 코드를 작성하십시오.

opCodeCachingsIntIficInlyIntImeRimproveSphpperformanceCachingCompileDCode, retingServerLoadandResponsEtimes.1) itStoresCompyledPhpCodeInMemory, BYPASSINGPARSINGCOMPILING.2) UseOpCacheSettingParametersInphP.Ini, likeMoryConsAncme AD


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전

VSCode Windows 64비트 다운로드
Microsoft에서 출시한 강력한 무료 IDE 편집기