• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_empty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中is_empty函数的典型用法代码示例。如果您正苦于以下问题:PHP is_empty函数的具体用法?PHP is_empty怎么用?PHP is_empty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了is_empty函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: valid_csrf_token

function valid_csrf_token($csrf_token)
{
    if (is_empty($_SESSION["csrf_token"])) {
        return false;
    }
    return $csrf_token == $_SESSION["csrf_token"];
}
开发者ID:aymericbouzy,项目名称:cluedo-solver,代码行数:7,代码来源:csrf.php


示例2: login

 public function login()
 {
     if (is_empty($this->post->user) || is_empty($this->post->password)) {
         throw_exception("User and Password are required");
     }
     $options['user']['lvl2'] = "one_login";
     $cod['user']['user'] = $this->post->user;
     $cod['user']['password'] = $this->post->password;
     $this->orm->connect();
     $this->orm->read_data(array("user"), $options, $cod);
     $user = $this->orm->get_objects("user");
     #echo $user[0]->get('type');
     $this->orm->close();
     if (is_empty($user)) {
         throw_exception("User or Password Incorrect");
     } else {
         $_SESSION['user']['id'] = $user[0]->get('id');
         $_SESSION['user']['name'] = $user[0]->get('name');
         $_SESSION['user']['user'] = $user[0]->get('user');
         $_SESSION['user']['type'] = $user[0]->get('type');
         $_SESSION['user']['email'] = $user[0]->get('email');
         $this->session = $_SESSION;
         $this->engine->assign('type_warning', 'success');
         $this->engine->assign('msg_warning', "Welcome!");
         $this->temp_aux = 'message.tpl';
     }
 }
开发者ID:ancdiazmo,项目名称:ghost_mi_version,代码行数:27,代码来源:index.php


示例3: agregar

 public function agregar()
 {
     $parque = new parque($this->post);
     if (is_empty($parque->get('codigo'))) {
         throw_exception("Debe ingresar un codigo");
     }
     if ($parque->get("nivel") == "alto" || $parque->get("nivel") == "bajo") {
     } else {
         throw_exception("El nivel debe de ser alto o bajo");
     }
     if ($parque->get("municipio") == "medellin" || $parque->get("municipio") == "rionegro" || $parque->get("municipio") == "la estrella" || $parque->get(" municipio") == "copacabana" || $parque->get(" municipio") == "guatape") {
     } else {
         throw_exception("El municipio debe de ser medellin, rionegro, la estrella, copacabana o guatape");
     }
     print_r($parque);
     $this->orm->connect();
     $this->orm->insert_data("normal", $parque);
     $this->orm->close();
     settype($data, 'object');
     $data->fecha = date("y-m-d");
     $data->calificacion = 0;
     $data->parque = $parque->get("codigo");
     $calificacion = new calificacion($data);
     $this->orm->connect();
     $this->orm->insert_data("normal", $calificacion);
     $this->orm->close();
     $this->type_warning = "sucess";
     $this->msg_warning = "parque agregado correctamente";
     $this->temp_aux = 'message.tpl';
     $this->engine->assign('type_warning', $this->type_warning);
     $this->engine->assign('msg_warning', $this->msg_warning);
 }
开发者ID:Gonzo107,项目名称:Parcial2AndresGonzalez,代码行数:32,代码来源:c_agregar_parque.php


示例4: menu_affiliates

function menu_affiliates($args)
{
    if (defined('NO_DB')) {
        return;
    }
    global $objTPL, $objSQL;
    $settings = array('limit' => doArgs('limit', 6, $args), 'perRow' => doArgs('limit', 2, $args));
    //grab the table
    $table = $objSQL->getTable('SELECT * FROM `$Paffiliates` WHERE active = 1 AND showOnMenu = 1 ORDER BY rand() LIMIT %d;', array($settings['limit']));
    if ($table === NULL) {
        return 'Error: Could not query Affiliates.';
    }
    if (is_empty($table)) {
        return 'Error: No Affiliates in the database active.';
    }
    $return = NULL;
    $counter = 1;
    foreach ($table as $a) {
        $title = secureMe($a['title']) . '
            In: ' . $a['in'] . ' | Out: ' . $a['out'];
        $return .= '<a href="/' . root() . 'affiliates.php?out&id=' . $a['id'] . '" title="' . $title . '" target="_blank" rel="nofollow"><img src="' . $a['img'] . '" alt="' . $title . '" /></a>';
        if ($counter % $settings['perRow'] == 0) {
            $return .= '<br />';
        }
        $counter++;
    }
    return '<center>' . $return . '</center>';
}
开发者ID:richard-clifford,项目名称:cmsv1,代码行数:28,代码来源:block.php


示例5: registrar

 public function registrar()
 {
     $parque = new parque($this->post);
     $this->engine->assign('codigo', $parque->get('codigo'));
     $this->engine->assign('nombre', $parque->get('nombre'));
     $this->engine->assign('municipio', $parque->get('municipio'));
     $this->engine->assign('nivel', $parque->get('nivel'));
     if (is_empty($parque->get('codigo'))) {
         throw_exception("Debe ingresar un Codigo");
     } elseif (!is_numeric($parque->get('codigo')) or $parque->get('codigo') < 0) {
         throw_exception("Codigo invalido");
     }
     if (is_empty($parque->get('nombre'))) {
         throw_exception("Debe ingresar un nombre");
     }
     if (is_empty($parque->get('municipio'))) {
         throw_exception("Debe ingresar un municipio");
     } elseif ($parque->get('municipio') != "Medellín" and $parque->get('municipio') != "Rionegro" and $parque->get('municipio') != "La Estrella" and $parque->get('municipio') != "Copacabana" and $parque->get('municipio') != "Guatapé") {
         throw_exception("Municipio invalido, municipios validos: Medellín, Rionegro, La Estrella, Copacabana, Guatapé");
     }
     if (is_empty($parque->get('nivel'))) {
         throw_exception("Debe ingresar un nivel");
     } elseif ($parque->get('nivel') != "alto" and $parque->get('nivel') != "bajo") {
         throw_exception("Nivel invalido, niveles validos: alto, bajo");
     }
     $this->orm->connect();
     $this->orm->insert_data("normal", $parque);
     $this->orm->close();
     $this->type_warning = "Exito";
     $this->msg_warning = "parque agregado correctamente";
     $this->temp_aux = 'message.tpl';
     $this->engine->assign('type_warning', $this->type_warning);
     $this->engine->assign('msg_warning', $this->msg_warning);
 }
开发者ID:rsanbo,项目名称:parcialfinal,代码行数:34,代码来源:registrar_parque.php


示例6: validarCompletitud

 public function validarCompletitud()
 {
     if (is_empty($this->get('nombre')) || is_empty($this->get('retribucion')) || is_empty($this->get('fechaPublicacion')) || is_empty($this->get('fechaFinalizacion')) || is_empty($this->get('empresa'))) {
         return false;
     }
     return true;
 }
开发者ID:kyespinosaz,项目名称:encuestando,代码行数:7,代码来源:encuesta.php


示例7: add

 public function add()
 {
     $parque = new parque($this->post);
     if (is_empty($parque->get('nivel'))) {
         throw_exception("Debe ingresar un nivel");
     }
     $parque = new parque($this->post);
     if (is_empty($parque->get('nivel'))) {
         throw_exception("Debe ingresar un municipio");
     }
     if ($parque->get('municipio') != "Medellín" && $parque->get('municipio') != "La estrella" && $parque->get('municipio') != "Rionegro" && $parque->get('municipio') != "Copacabana" && $parque->get('municipio') != "Guatapé") {
         throw_exception("Municipio inválido");
     }
     if ($parque->get('nivel') != "alto" && $parque->get('nivel') != "bajo") {
         throw_exception("Nivel inválido");
     }
     $this->orm->connect();
     $this->orm->insert_data("normal", $parque);
     $this->orm->close();
     $this->type_warning = "sucess";
     $this->msg_warning = "Parque registrado correctamente";
     $this->temp_aux = 'message.tpl';
     $this->engine->assign('type_warning', $this->type_warning);
     $this->engine->assign('msg_warning', $this->msg_warning);
 }
开发者ID:alvasquezta,项目名称:parcial2,代码行数:25,代码来源:registrar_parque.php


示例8: formFunctions

 /**
  * Test savingForm
  * Test so a proper form is saved, with correct data.
  * Also test if it is possible to enter incorrect data that might ruin something.
  * @author Fredrik Andersson
  * @small
  * @test
  */
 public function formFunctions()
 {
     // Create new user class
     $a = new PP();
     // Check if the object was created
     $this->assertNotNull($a);
     // Adding some variables into the form class PP
     $a->student1 = "StudentName";
     $this->assertEquals("StudentName", $a->student1);
     //Test of the function test_num($data)
     $this->assertEquals(1, test_num(1));
     $this->assertEquals("-", test_num("-"));
     $this->assertEquals("-", test_num(10));
     //Test of the function test_input($data)
     $this->assertEquals("123", test_input("  123  "));
     //trim() removes spaces before the first char and after the last one.
     $this->assertEquals("123'hihi\ttab", test_input("123\\'hi\\hi\ttab"));
     //stripslashes() removes all slashes exept proper slashes like \t and \n etc.
     $this->assertEquals("&amp; &quot; &lt; &gt;", test_input("& \" < >"));
     //htmlspecialchars() changes some special characters to code that html can handle.
     //Test of the function is_empty($data)
     $this->assertEquals(false, is_empty(array('apple', 'banana ', ' cranberry ')));
     $this->assertEquals(false, is_empty(array('', '', '')));
     $temp[10] = "something";
     $this->assertEquals(false, is_empty($temp));
     //Test of the function input_length()
     $string128 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
     $string129 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab";
     $this->assertEquals($string128, input_length($string129));
     //Test of the function length_one()
     $this->assertEquals("1", length_one("12345"));
 }
开发者ID:RosanderOliver,项目名称:DV1512_Projekt_HT2015,代码行数:40,代码来源:FormTest.php


示例9: testIsEmpty

 public function testIsEmpty()
 {
     $this->assertTrue(is_empty(null));
     $this->assertTrue(is_empty(''));
     $this->assertTrue(is_empty(0));
     $this->assertFalse(is_empty('asd'));
 }
开发者ID:kiasaki,项目名称:vexillum,代码行数:7,代码来源:FunctionsTest.php


示例10: validarCompletitud

 public function validarCompletitud()
 {
     if (is_empty($this->get('nit')) || is_empty($this->get('nombre')) || is_empty($this->get('direccion')) || is_empty($this->get('telefono'))) {
         return false;
     }
     return true;
 }
开发者ID:kyespinosaz,项目名称:encuestando,代码行数:7,代码来源:empresa.php


示例11: validarIntereses

 private function validarIntereses()
 {
     if (is_empty($this->post->interes)) {
         return false;
     }
     return true;
 }
开发者ID:jsmarinn,项目名称:DCPS_Repaso,代码行数:7,代码来源:c_registrar_usuario.php


示例12: execute

 public function execute(Sabel_Bus $bus)
 {
     $response = $bus->get("response");
     if ($response->isRedirected()) {
         return;
     }
     $controller = $bus->get("controller");
     $responses = $response->getResponses();
     $contents = isset($responses["contents"]) ? $responses["contents"] : "";
     $view = $this->setTemplateName($bus->get("view"), $response->getStatus(), $bus->get("destination")->getAction(), $bus->get("IS_AJAX_REQUEST") === true);
     if (is_empty($contents)) {
         if ($location = $view->getValidLocation()) {
             $contents = $view->rendering($location, $responses);
         } elseif (!$controller->isExecuted()) {
             $response->getStatus()->setCode(Sabel_Response::NOT_FOUND);
             if ($location = $view->getValidLocation("notFound")) {
                 $contents = $view->rendering($location, $responses);
             } else {
                 $contents = "<h1>404 Not Found</h1>";
             }
         }
     }
     if ($bus->get("NO_LAYOUT")) {
         $bus->set("result", $contents);
     } else {
         $layout = isset($responses["layout"]) ? $responses["layout"] : DEFAULT_LAYOUT_NAME;
         if ($location = $view->getValidLocation($layout)) {
             $responses["contentForLayout"] = $contents;
             $bus->set("result", $view->rendering($location, $responses));
         } else {
             // no layout.
             $bus->set("result", $contents);
         }
     }
 }
开发者ID:reoring,项目名称:sabel,代码行数:35,代码来源:View.php


示例13: JKY_buscar_cep

/**
 *	$.ajax({ method: buscar_cep, cep: 12345-678, state: '', city: '', street2: '', street1: '', district: '', country: '' })
 *
 *	return: [ x...x, ..., x...x ]
 */
function JKY_buscar_cep($data)
{
    $my_cep = fix_digits($data['zip']);
    if (strlen($my_cep) == 8) {
        if ($data['state'] == '' or $data['city'] == '' or $data['street2'] == '' or $data['street1'] == '' or $data['district'] == '') {
            $my_curl = curl_init();
            curl_setopt($my_curl, CURLOPT_URL, 'http://www.buscarcep.com.br/?&chave=146RwGh.Q3UM1x2871JTmxKemqLfYX/&formato=xml&cep=' . $my_cep);
            curl_setopt($my_curl, CURLOPT_RETURNTRANSFER, 1);
            $my_return = curl_exec($my_curl);
            curl_close($my_curl);
            if (!is_empty($my_return)) {
                $my_cep = new SimpleXMLElement($my_return);
                if ($my_cep->retorno->resultado == '1') {
                    $data['state'] = remover_acentos($my_cep->retorno->uf);
                    $data['city'] = remover_acentos($my_cep->retorno->cidade);
                    $data['street2'] = remover_acentos($my_cep->retorno->bairro);
                    $data['street1'] = remover_acentos($my_cep->retorno->tipo_logradouro . ' ' . $my_cep->retorno->logradouro);
                    $data['district'] = remover_acentos($my_cep->retorno->ibge_municipio_verificador);
                }
            }
        }
        $data['country'] = get_control_value('System Defaults', 'Company Country');
    }
    $data['status'] = 'ok';
    return $data;
}
开发者ID:shadobladez,项目名称:erp2,代码行数:31,代码来源:Buscar_CEP.php


示例14: getContent

 public function getContent()
 {
     if (is_empty($this->path)) {
         return "";
     } else {
         return file_get_contents($this->path);
     }
 }
开发者ID:reoring,项目名称:sabel,代码行数:8,代码来源:File.php


示例15: select_cards_player

function select_cards_player($player)
{
    $player = select_with_request_string("cards", "player", array("player", "cards", "game"), array(), array("game" => game, "player" => $player));
    if (!is_empty($player[0]["cards"])) {
        return $player[0]["cards"];
    }
    return 0;
}
开发者ID:aymericbouzy,项目名称:cluedo-solver,代码行数:8,代码来源:player.php


示例16: displayMessages

function displayMessages()
{
    $engine = EngineAPI::singleton();
    if (is_empty($engine->errorStack)) {
        return FALSE;
    }
    return '<section><header><h1>Results</h1></header>' . errorHandle::prettyPrint() . '</section>';
}
开发者ID:PseudoAj,项目名称:mfcs,代码行数:8,代码来源:functions.php


示例17: query_array_unselecting_tag

function query_array_unselecting_tag($tag, $query_array)
{
    $query_array["tags"] = array_diff($query_array["tags"], array($tag));
    if (is_empty($query_array["tags"])) {
        unset($query_array["tags"]);
    }
    return $query_array;
}
开发者ID:aymericbouzy,项目名称:cluedo-solver,代码行数:8,代码来源:tag.php


示例18: get_status

function get_status($card, $player)
{
    $results = select_with_request_string("status", "owned", array("game", "player", "card", "status"), array(), array("game" => game, "player" => $player, "card" => $card));
    if (!is_empty($results)) {
        return $results[0]["status"];
    }
    return unknown;
}
开发者ID:aymericbouzy,项目名称:cluedo-solver,代码行数:8,代码来源:owned.php


示例19: Render

    public function Render($form = "", $response_location = "", $url = "", $args = "")
    {
        $errorMsg = '';
        $errors = FALSE;
        $Load = new Load();
        if (function_exists('is_empty') == FALSE) {
            // Load validate helper
            $Load->Helper('validate');
        }
        if (is_empty($form) == FALSE) {
            $this->form = $form;
        }
        if (is_empty($response_location) == FALSE) {
            $this->response_location = $response_location;
        }
        if (is_empty($url) == FALSE) {
            $this->url = $url;
        }
        if (is_empty($args) == FALSE) {
            $this->args = $args;
        }
        if (is_empty($this->form)) {
            $errorMsg .= ' form requerido :$obj-> Form("id-form")<br /> ';
            $errors = TRUE;
        }
        if (is_empty($this->response_location)) {
            $errorMsg .= ' response_location requerido : $obj-> ResponseLocation("id-div-location")<br /> ';
            $errors = TRUE;
        }
        if (is_empty($this->url)) {
            $errorMsg .= ' url requerida : $obj-> Url("Controller/Action")<br /> ';
            $errors = TRUE;
        }
        if ($errors == TRUE) {
            echo 'Error:<br />' . $errorMsg;
            return FALSE;
        } else {
            // Crear respuesta
            $butonsCode = $this->RenderButtons();
            $params = 'form:' . $this->form . ';url:' . $this->url . ';args:' . $this->args . ';';
            $fx = new fk_ajax('submit', $this->response_location, $params);
            $Result = ' <script type="text/javascript">
<!--
' . $butonsCode . '
$("#' . $this->form . '").validate({
	 submitHandler: function(form) {
		 ' . $fx->render() . '
		 return false;
	 },invalidHandler: function(form, validator){
      var errors = validator.numberOfInvalids();
      if (errors) { alert("Por favor, llena los campos obligatorios");}
	 }
});
//-->
</script>';
            return $Result;
        }
    }
开发者ID:mtaisigue,项目名称:albaranes,代码行数:58,代码来源:fk_ajax_submit.php


示例20: testIsEmpty

 public function testIsEmpty()
 {
     $this->assertTrue(is_empty(''));
     $this->assertTrue(is_empty('    '));
     $this->assertTrue(is_empty(null));
     $this->assertTrue(is_empty(false));
     $this->assertFalse(is_empty(0));
     $this->assertFalse(is_empty('foobar'));
     $this->assertFalse(is_empty(true));
 }
开发者ID:howlowck,项目名称:support,代码行数:10,代码来源:HelpersTest.php



注:本文中的is_empty函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_empty_date函数代码示例发布时间:2022-05-15
下一篇:
PHP is_emp函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap