PHP - 推送到数组不起作用

时间:2017-02-20 21:40:01

标签: php

        <?php
    $avaliableLines = array();
    echo '<div class="dropdown">';
    echo '<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Today Line
      <span class="caret"></span></button>';
    echo '<ul class="dropdown-menu">';
        foreach ($avaliableLines as $menuElements) {
            echo '<li><a href="#">'.$menuElements.'</a></li>';
        }
    echo '</ul>';
    echo '</div>';


    $urlSite = file_get_html('http://18130126.com/ubetportal/?clientId=137/');
    foreach ($urlSite->find('.ui-collapsible-content') as $element) {
        echo $element;
    }



    error_reporting(E_ERROR | E_PARSE);

    //NBA y sus periodos
    $nbaAndPeriodos = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/3/');
    $obj = json_decode($nbaAndPeriodos);
    echo $obj->result[0];
    if (!empty($obj->result[0])) {
       $avaliableLines[] = "NBA";
    };

    //College Basketball-Juego Completo y Primera Mitad
    $collegeBasketBall = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/4/');
    $obj2 = json_decode($collegeBasketBall);
    echo $obj2->result[0];
    if (!empty($obj2->result[0])) {
       $avaliableLines[] = "College Basketball";
    };


    //NHL-Juego Completo y Primera Mitad
    $hockeyContent = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/7/');
    $objHackey = json_decode($hockeyContent);
    echo $objHackey->result[0];
    if (!empty($objHackey->result[0])) {
       $avaliableLines[] = "NHL";
    };

    //Golf-Juego Completo
    $golfContent = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/11/');
    $objgolf = json_decode($golfContent);
    echo $objgolf->result[0];
    // Si ay gold entonces agrega golf al menu del golf
    if (!empty($objgolf->result[0])) {
       $avaliableLines[] = "Golf";
    };
    //Tennis - Juego Completo
    $tennisContent = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/12/');
    $objtennis = json_decode($tennisContent);
    echo $objtennis->result[0];
    if (!empty($objtennis->result[0])) {
       $avaliableLines[] = "Tennis";
    };

    //Italian Serie A leafue - Juego Completo y Primera Mitad
    $italianSerieContent = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/24/');
    $objitalian = json_decode($italianSerieContent);
    echo $objitalian->result[0];
    if (!empty($objitalian->result[0])) {
       $avaliableLines[] = "Italin Serie";
    };


    //Spanish La Liga - Juego Completo y Primera Mitad
    $spanishContent = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/25/');
    $objSpanish= json_decode($spanishContent);
    echo $objSpanish->result[0];
    if (!empty($objSpanish->result[0])) {
       $avaliableLines[] = "Spanish La Liga";
    };

    //Mexican Primera League - Juego Completo y Primera Mitad
    $mexicanContent = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/29/');
    $objMexican = json_decode($mexicanContent);
    echo $objMexican->result[0];
    if (!empty($objMexican->result[0])) {
       $avaliableLines[] = "Mexican Primera League";
    };

    //French Ligue 1- Juego Completo y Primeta Mitad
    $frenchContent = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/31/');
    $objfrench = json_decode($frenchContent);
    echo $objfrench->result[0];
    if (!empty($objfrench->result[0])) {
       $avaliableLines[] = "French Ligue";
    };


    //Boxing Ligue 1- Juego Completo y Primeta Mitad
    $boxingContent = file_get_contents('http://18130126.com//ubetportal/UbetWebIISFmxService.dll/datasnap/rest/TServerMethods1/GetData_League_Details/137/10/');
    $objboxing = json_decode($boxingContent);
    echo $objboxing->result[0];
    if (!empty($objboxing->result[0])) {
       $avaliableLines[] = "Boxing Ligue";
    };



     ?>

我想要,例如,如果objets返回一些东西,所以我想要推入数组,但不要推动任何东西

所以这是我的所有代码..当语句if完成后我想将元素回显到下拉列表中......

0 个答案:

没有答案