Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- UTF-8
- Linux
- string
- Regex
- curl
- 경영
- Forms
- Laravel
- Session
- Arrays
- jquery
- HTML
- date
- composer-php
- JavaScript
- 무료다운로드쿠폰
- post
- 웹하드순위
- 전략
- OOP
- file-upload
- php
- function
- MySQL
- Ajax
- JSON
- 웹하드추천
- Apache
- variables
Archives
- Today
- Total
개발! 딱 깔끔하고 센스있게!
PHP DOM: getElement by Tag Name 본문
나 는 어 리 석 은 질문 이 라 고 걱정 했 지만, 지난 두 시간 동안 많은 그룹 을 시도 한 후에 나 는 정말 곤경 에 빠 졌 다.
XML 파일 에서 이름 을 추출 하려 고 하고 있 습 니 다.
내 XML 파일:
John
나의 phop:
$doc = new DOMDocument(); $doc -> load( "thefile.xml" ); $thename = $doc -> getElementsByTagName( "name" ); $myname= $thename -> getElementsByTagName("name") -> item(0) -> nodeValue;
오류:
Catchable fatal error: Object of class DOMElement could not be converted to string in phpreader.php
해 봤 어 요.
$myname= $thename -> getElementsByTagName("name") -> item(0) ; $myname= $doc -> getElementsByTagName("name") -> item(0) -> nodeValue; $myname= $doc -> getElementsByTagName("name") -> item(0) ;
다 실 패 했 습 니 다.
정확 한 조합 을 제외 하고 나 는 거의 모든 조합 을 시도 했다.
(
대답 하 다.
$my name = $thename - > item (0) - > node발 루 가 필요 할 수 있 습 니 다.
$the name 은 "name" 의 모든 노드 로 표 시 된 Nodelist 입 니 다.
이 노드 의 첫 번 째 항목 (- > item (0) 이 필요 하 며, 노드 값 (- > nodelavue) 이 필요 합 니 다.
$thename 은 $names 라 는 이름 을 좀 더 적절 하 게 해 야 합 니 다.
$names - > item (0) - > nodebalue 는 언어 적 으로 의미 가 있 는 것 을 보 게 될 것 입 니 다.
이것 은 MeTM 에 효과 가 있다.
'개발 스크랩 메모 > PHP' 카테고리의 다른 글
Facebook Graph API 에서 사용자 의 이메일 주소 와 성별 을 가 져 오 는 API 호출 은 무엇 입 니까? (0) | 2020.12.03 |
---|---|
PHP 의 드 롭 다운 상자 에서 선택 한 값 가 져 오기 (0) | 2020.12.03 |
PHP 로 멀 티 알림 시스템 을 구축 하 는 가장 좋 은 방법 (0) | 2020.12.02 |
서로 다른 매개 변수 PHP 재 작성 함수 (0) | 2020.12.02 |
어떻게 Symforny 2 를 PHP 로 CSS, JS 파일 을 불 러 오 는 것 이 아 닙 니까? (0) | 2020.12.02 |
Comments