안녕하세요 밑에 http://도메인(번호1부터10).com/test.php 에 숫자가 들어있는데요
그냥 아래소스로 하면 숫자 10개만 출력 됩니다. 그 숫자를 더한값(합한값) 으로 나타낼수 있나요? 도와주세요^^
그냥 아래소스로 하면 숫자 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);
}
?>
$_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개
채택된 답변
+20 포인트
이렇게 하고 싶으신거에요?
Copy
<?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
<?
$_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 이페이지안에 있는 숫자값이 출력됩니다. 여기서 출력화면에 표시된 숫자를 다 더하고 싶은거에요^^
이렇게 http://도메인(1~10).com/test.php 이페이지안에 있는 숫자값이 출력됩니다. 여기서 출력화면에 표시된 숫자를 다 더하고 싶은거에요^^
답변을 작성하려면 로그인이 필요합니다.