언제 $this에 self를 사용해야 합니까?

PHP 5에서 사용하는 것과self그리고.$this? 각각 언제가 적당합니까? 질문에 대한 답변 단답 사용하다$this현재 객체를 참조합니다.사용하다self현재 클래스를 참조합니다.즉,$this->member비정적 멤버의 경우 사용self::$member스태틱 멤버용입니다. 풀답변 다음은 의 올바른 사용 예를 제시하겠습니다.$this그리고.self스태틱 및 스태틱멤버 변수의 경우: <?php class X { private $non_static_member = 1; private static $static_member = 2; function __construct() { echo $this->non_static_member . ‘ ‘ . self::$static_member; } … Read more

PHP는 실제로 어떻게 작동합니까?

여기 앞에 제가 뭘 알고 있는지 말씀드리겠습니다.foreach사용법입니다.이 질문은 보닛 아래에서 어떻게 동작하는지에 관한 것입니다.또, 「이것이 어레이를 루프 하는 방법입니다.」라고 하는 식으로 대답하고 싶지 않습니다.foreach“. 오랫동안 나는 그렇게 생각했다.foreach어레이 자체를 조작했습니다.그 후, 어레이의 카피와 함께 동작하는 것에 대한 많은 참조를 발견해, 이것으로 이야기가 끝난다고 생각하고 있습니다.하지만 최근에 그 문제에 대해 논의를 시작했고, 약간의 실험 결과 이것이 … Read more

PHP에서 HTML/XML을 어떻게 해석하고 처리합니까?

How can one parse HTML/XML and extract information from it?HTML/XML을 해석하고 정보를 추출하려면 어떻게 해야 합니까? 질문에 대한 답변 Native XML Extensions네이티브 XML 확장자 I prefer using one of the native XML extensions since they come bundled with PHP, are usually faster than all the 3rd party libs and give me all the control I … Read more

Categories PHP

문자열에 특정 단어가 포함되어 있는지 확인하려면 어떻게 해야 합니까?

This question’s answers are a community effort.이 질문의 답변은 지역사회의 노력입니다. Edit existing answers to improve this post.기존 답변을 편집하여 이 게시물을 개선하십시오. It is not currently accepting new answers or interactions.현재 새로운 답변이나 상호작용을 받아들이지 않고 있습니다. Consider:고려사항: $a = ‘How are you?’; if ($a contains ‘are’) echo ‘true’; Suppose I have the code … Read more

Categories PHP

PHP에서 mysql_* 함수를 사용하면 안 되는 이유는 무엇입니까?

Want to improve this post?이 게시물을 개선하시겠습니까? Provide detailed answers to this question, including citations and an explanation of why your answer is correct.인용문 및 답변이 올바른 이유를 포함하여 이 질문에 대한 자세한 답변을 제공하십시오. Answers without enough detail may be edited or deleted.충분한 세부 정보가 없는 답변은 편집 또는 삭제할 수 있습니다. What are … Read more

Categories PHP

YouTube API에서 YouTube 비디오 섬네일을 얻으려면 어떻게 해야 하나요?

If I have a YouTube video URL, is there any way to use PHP and cURL to get the associated thumbnail from the YouTube API?YouTube 동영상 URL이 있는 경우, PHP와 cURL을 사용하여 YouTube API에서 관련 섬네일을 얻을 수 있는 방법이 있습니까? 질문에 대한 답변 Each YouTube video has four generated images.각 YouTube 비디오는 4개의 생성된 … Read more

Categories PHP

PHP에서 SQL 주입을 방지하려면 어떻게 해야 합니까?

This question’s answers are a community effort.이 질문의 답변은 지역사회의 노력입니다. Edit existing answers to improve this post.기존 답변을 편집하여 이 게시물을 개선하십시오. It is not currently accepting new answers or interactions.현재 새로운 답변이나 상호작용을 받아들이지 않고 있습니다. If user input is inserted without modification into an SQL query, then the application becomes vulnerable to … Read more

Categories PHP

PHP의 배열에서 요소 삭제

Is there an easy way to delete an element from an array using PHP, such that PHP를 사용하여 어레이에서 요소를 쉽게 삭제할 수 있는 방법이 있습니까?foreach ($array) no longer includes that element?더 이상 그 요소를 포함하지 않는가? I thought that setting it to 나는 그것을 로 설정하는 것이null would do it, but apparently it does … Read more

Categories PHP

참조 – 이 기호는 PHP에서 무엇을 의미합니까?

What is this?이게 뭐야? This is a collection of questions that come up every now and then about syntax in PHP.이것은 PHP의 구문에 관한 질문의 모음입니다. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.또한 커뮤니티 위키이므로 모든 사용자가 이 목록 관리에 참여하도록 초대됩니다. Why is this?왜 이러한가? … Read more

Categories PHP