echo 수 더하기 질문입니다.

echo 수 더하기 질문입니다.

QA

echo 수 더하기 질문입니다.

본문

안녕하세요 밑에  http://도메인(번호1부터10).com/test.php 에 숫자가 들어있는데요 

그냥 아래소스로 하면 숫자 10개만 출력 됩니다.  그 숫자를 더한값(합한값) 으로 나타낼수 있나요? 도와주세요^^
 
<?
$_conf__url = array();
$_conf__url[] = "http://도메인1.com/test.php" ;
$_conf__url[] = "http://도메인2.com/test.php" ;
$_conf__url[] = "http://도메인3.com/test.php" ;
$_conf__url[] = "http://도메인4.com/test.php" ;
$_conf__url[] = "http://도메인5.com/test.php" ;
$_conf__url[] = "http://도메인6.com/test.php" ;
$_conf__url[] = "http://도메인7.com/test.php" ;
$_conf__url[] = "http://도메인8.com/test.php" ;
$_conf__url[] = "http://도메인9.com/test.php" ;
$_conf__url[] = "http://도메인10.com/test.php" ;
$cnt=count($_conf__url);
$resultset=array();
for( $i = 0; $i < $cnt; $i++ ){
    $url = $_conf__url[$i];
 ini_set("allow_url_fopen", 1);
   echo $resultset[$url] = file_get_contents($url);
}
?>

이 질문에 댓글 쓰기 :

답변 7

이렇게 하고 싶으신거에요?

<?php
$thisArray = array(1,2,3,4,5,6,7,8,9,10);
foreach($thisArray AS $item => $val){
    $vals = $vals+$val;
    echo("배열번호 : ".$item." 배열값 : ".$val." ---- Is this Domain? http://www.domain".$vals.".com/test.php<br />");
} 
?>

그 숫자를 더한값(합한값) 으로 나타낼수 있나요?

이게 뭔말인가요?

질문을 좀 더 상세히 그리고 요점을 집어서 질문해주세요
다시 질문하겠습니다.ㅜㅜ
<?
$_conf__url = array();
$_conf__url[] = "http://도메인1.com/test.php" ;
$_conf__url[] = "http://도메인2.com/test.php" ;
$_conf__url[] = "http://도메인3.com/test.php" ;
$_conf__url[] = "http://도메인4.com/test.php" ;
$_conf__url[] = "http://도메인5.com/test.php" ;
$_conf__url[] = "http://도메인6.com/test.php" ;
$_conf__url[] = "http://도메인7.com/test.php" ;
$_conf__url[] = "http://도메인8.com/test.php" ;
$_conf__url[] = "http://도메인9.com/test.php" ;
$_conf__url[] = "http://도메인10.com/test.php" ;
$cnt=count($_conf__url);
$resultset=array();
for( $i = 0; $i < $cnt; $i++ ){
$url = $_conf__url[$i];
ini_set("allow_url_fopen", 1);
echo $resultset[$url] = file_get_contents($url);
}
?>

-------------------------------------출력화면-----------------
1000
234
2323
235
23523
2352
232
123
123
152
-------------------------------------------------출력화면--------------------
이렇게 http://도메인(1~10).com/test.php  이페이지안에 있는  숫자값이 출력됩니다. 여기서  출력화면에 표시된 숫자를 다 더하고 싶은거에요^^
그러니깐  배열 $_conf__url[] 안의 url 의페이지에 숫자가 입력되어있습니다.

지금 보여드린 소스는 그숫자를 나열하는 소스이죠?
 
결론:  url페이지 에 있는 숫자를 123+124+1244+1252363+2341+12124+125125+125+125  이런식으로 더하고 싶은거에요...ㅠㅠ 제가 설명이 부족해서 죄송합니다...  
답변을 작성하시기 전에 로그인 해주세요.
전체 123,522 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT