php打开数据库中链接 做成链接吧 用GET传一个参数 然后 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 依次取出记录,然后使用curl即可 至于curl的用法楼主查一下手册吧,也可以使用file或者file_get_contents <input type="button" value="ttt" name='ttt' onclick='window.location="query.php"'/><?php //连接数据库,修改成自己的用户名和密码 $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); mysql_select_db("数据库名", $link); $result = mysql_query("SELECT url FROM 表名"); while($row = mysql_fetch_row($result)) { file_get_contents($row[0]); } mysql_free_result($result); mysql_close($link);?> 这些是我的代码,已经可以实现把相对应的链接读出来在页面上显示,楼上的大哥麻烦教教小弟怎么改require('../../config.inc.php');require_once('common.php');require_once('builds.inc.php');require_once('results.inc.php');require_once("../../lib/functions/lang_api.php");testlinkInitPage();$arrData = array();$arrBuilds = getBuilds($_SESSION['testPlanId'], " ORDER BY build.name ");// is output is excel?$xls = FALSE;if (isset($_GET['format']) && $_GET['format'] =='excel'){ $xls = TRUE;}// 20050919 - fm$sql = " SELECT mgttcid,url" . " FROM project TP, component COMP, category CAT, testcase TC, mgtcomponent MGTCOMP, mgtcategory MGTCAT " . " WHERE MGTCOMP.id = COMP.mgtcompid " . " AND MGTCAT.id = CAT.mgtcatid " . " AND COMP.projid=TP.id " . " AND CAT.compid=COMP.id " . " AND TC.catid=CAT.id" . " AND TP.id=" . $_SESSION['testPlanId'];$result = do_mysql_query($sql);$bRights = has_rights("tp_execute") && !$xls;while ($myrow = mysql_fetch_assoc($result)){ //Cycle through all of the test cases $container = null; $container[] = htmlspecialchars($myrow['mgttcid'] . ' / ' . $myrow['mgttcid']); $container[] = "<b>" . $myrow['url'] . "</b>:"; ///SCHLUNDUS $arrData[] = $container;}// for excel send headerif ($xls) sendXlsHeader();$smarty = new TLSmarty;$smarty->assign('title', lang_get('title_test_report_all_builds'));$smarty->assign('arrData', $arrData);$smarty->assign('arrBuilds', $arrBuilds);if ($xls) { $smarty->assign('printDate', strftime($g_date_format, time()) ); $smarty->assign('user', $_SESSION['user']);}$smarty->display('urlrun.tpl');urlrun.tpl的代码{include file="inc_head.tpl"}<body>{if $printDate == ''}<h1>{$title|escape}</h1>{else}{* print data to excel *}{/if}<div class="workBack"><table class="simple" style="width: 100%; text-align: center; margin-left: 0px;"> <tr> <th>ID</th> <th>url</th> </tr>{section name=Row loop=$arrData} <tr> {section name=Item loop=$arrData[Row]} <td>{$arrData[Row][Item]}</td> {/section} </tr>{/section}</table></div></body></html> 将url以get方式传递给一个xxx.php,记得传之前要编码一下.在xxx.php里获取,然后file_get_contents这个网址就行了. $sql = " SELECT url" . " FROM project TP, component COMP, category CAT, testcase TC, mgtcomponent MGTCOMP, mgtcategory MGTCAT " . " WHERE MGTCOMP.id = COMP.mgtcompid " . " AND MGTCAT.id = CAT.mgtcatid " . " AND COMP.projid=TP.id " . " AND CAT.compid=COMP.id " . " AND TC.catid=CAT.id" . " AND TP.id=" . $_SESSION['testPlanId'];$result = do_mysql_query($sql);$bRights = has_rights("tp_execute") && !$xls;while ($myrow = mysql_fetch_assoc($result)){ //Cycle through all of the test cases $container = null; $container[] = "<b>" . $myrow['url'] . "</b>:"; $echo $myrow['url'];}上面代码中 $myrow['url'] 已经是表中所有url的集合,怎么能依次执行集合中的url呢? 依次执行是个什么概念?啥叫执行url链接? 我这个数据库中的链接是对应的测试用例,也就是个ie链接,打开后,就会执行,我现在想做的就是把表中的每个url都打开一遍,就ok了。 明白了。直接<script>window.open("http://www.baidu.com")</script>就可以了~~~你可以写在js的for循环里面。 试试改改:$container[] = "<script>window.open('" . $myrow['url'] . "')</script>:"; 为什么运行后会提示缺少对象,高手指点下,帮我找找哪里错了,谢谢。$sql = " SELECT url" . " FROM project TP, component COMP, category CAT, testcase TC, mgtcomponent MGTCOMP, mgtcategory MGTCAT " . " WHERE MGTCOMP.id = COMP.mgtcompid " . " AND MGTCAT.id = CAT.mgtcatid " . " AND COMP.projid=TP.id " . " AND CAT.compid=COMP.id " . " AND TC.catid=CAT.id" . " AND TP.id=" . $_SESSION['testPlanId'];$result = do_mysql_query($sql);$bRights = has_rights("tp_execute") && !$xls;$urls = array();while ($myrow = mysql_fetch_assoc($result)){ //Cycle through all of the test cases $container = null; $container[] = "<b>" . $myrow['url'] . "</b>:"; ///SCHLUNDUS $urls[] = $myrow['url'];}echo '<script type="text/javascript">';echo 'function openURL(){';foreach($urls as $key=>$value){ echo 'window.open("'.$value.'")';}echo '}';echo '</script>';echo '<input type="button" value="ttt" name="ttt" onclick="openUrl()"/>'; 关于反汇编的问题 想买个空间,兄弟们给点提议啊 求一正则表达式. 从数据库中通过API提取产品信息,列在网站上!请问需要什么技术? 老大们:如何获取<input type="file" name="upfile">中的内容,包括完整的路径和文件名!我都快急死了,快来帮帮我啊!我等了好久好久,就 这是怎么回事,我从来没见过。 php配置问题,在线等!!! list可以用作数组中一项的名字么? 请问哪里有关于php3的中文书籍,比较好的!!! php怎么获取js值 给个php 能控制上传图片宽高代码 php怎么修改数据库表名
<?php
//连接数据库,修改成自己的用户名和密码
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
mysql_select_db("数据库名", $link);
$result = mysql_query("SELECT url FROM 表名");
while($row = mysql_fetch_row($result))
{
file_get_contents($row[0]);
}
mysql_free_result($result);
mysql_close($link);
?>
require('../../config.inc.php');
require_once('common.php');
require_once('builds.inc.php');
require_once('results.inc.php');
require_once("../../lib/functions/lang_api.php");
testlinkInitPage();$arrData = array();
$arrBuilds = getBuilds($_SESSION['testPlanId'], " ORDER BY build.name ");// is output is excel?
$xls = FALSE;
if (isset($_GET['format']) && $_GET['format'] =='excel'){
$xls = TRUE;
}// 20050919 - fm
$sql = " SELECT mgttcid,url" .
" FROM project TP, component COMP, category CAT, testcase TC, mgtcomponent MGTCOMP, mgtcategory MGTCAT " .
" WHERE MGTCOMP.id = COMP.mgtcompid " .
" AND MGTCAT.id = CAT.mgtcatid " .
" AND COMP.projid=TP.id " .
" AND CAT.compid=COMP.id " .
" AND TC.catid=CAT.id" .
" AND TP.id=" . $_SESSION['testPlanId'];$result = do_mysql_query($sql);
$bRights = has_rights("tp_execute") && !$xls;while ($myrow = mysql_fetch_assoc($result))
{ //Cycle through all of the test cases
$container = null;
$container[] = htmlspecialchars($myrow['mgttcid'] . ' / ' . $myrow['mgttcid']);
$container[] = "<b>" . $myrow['url'] . "</b>:";
///SCHLUNDUS
$arrData[] = $container;
}// for excel send header
if ($xls)
sendXlsHeader();$smarty = new TLSmarty;
$smarty->assign('title', lang_get('title_test_report_all_builds'));
$smarty->assign('arrData', $arrData);
$smarty->assign('arrBuilds', $arrBuilds);
if ($xls) {
$smarty->assign('printDate', strftime($g_date_format, time()) );
$smarty->assign('user', $_SESSION['user']);
}
$smarty->display('urlrun.tpl');urlrun.tpl的代码
{include file="inc_head.tpl"}<body>{if $printDate == ''}
<h1>{$title|escape}</h1>{else}{* print data to excel *}{/if}<div class="workBack">
<table class="simple" style="width: 100%; text-align: center; margin-left: 0px;">
<tr>
<th>ID</th>
<th>url</th>
</tr>
{section name=Row loop=$arrData}
<tr>
{section name=Item loop=$arrData[Row]}
<td>{$arrData[Row][Item]}</td>
{/section}
</tr>
{/section}
</table>
</div></body>
</html>
在xxx.php里获取,然后file_get_contents这个网址就行了.
$sql = " SELECT url" .
" FROM project TP, component COMP, category CAT, testcase TC, mgtcomponent MGTCOMP, mgtcategory MGTCAT " .
" WHERE MGTCOMP.id = COMP.mgtcompid " .
" AND MGTCAT.id = CAT.mgtcatid " .
" AND COMP.projid=TP.id " .
" AND CAT.compid=COMP.id " .
" AND TC.catid=CAT.id" .
" AND TP.id=" . $_SESSION['testPlanId'];$result = do_mysql_query($sql);
$bRights = has_rights("tp_execute") && !$xls;while ($myrow = mysql_fetch_assoc($result))
{ //Cycle through all of the test cases
$container = null;
$container[] = "<b>" . $myrow['url'] . "</b>:";
$echo $myrow['url'];
}
上面代码中 $myrow['url'] 已经是表中所有url的集合,怎么能依次执行集合中的url呢?
你可以写在js的for循环里面。
" FROM project TP, component COMP, category CAT, testcase TC, mgtcomponent MGTCOMP, mgtcategory MGTCAT " .
" WHERE MGTCOMP.id = COMP.mgtcompid " .
" AND MGTCAT.id = CAT.mgtcatid " .
" AND COMP.projid=TP.id " .
" AND CAT.compid=COMP.id " .
" AND TC.catid=CAT.id" .
" AND TP.id=" . $_SESSION['testPlanId'];$result = do_mysql_query($sql);
$bRights = has_rights("tp_execute") && !$xls;
$urls = array();while ($myrow = mysql_fetch_assoc($result))
{ //Cycle through all of the test cases
$container = null;
$container[] = "<b>" . $myrow['url'] . "</b>:"; ///SCHLUNDUS $urls[] = $myrow['url'];}echo '<script type="text/javascript">';
echo 'function openURL(){';foreach($urls as $key=>$value)
{
echo 'window.open("'.$value.'")';
}echo '}';
echo '</script>';echo '<input type="button" value="ttt" name="ttt" onclick="openUrl()"/>';