`
鹤惊昆仑
  • 浏览: 223547 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

if $0 == _FILE_

    博客分类:
  • ruby
阅读更多
if __name__ == "__main__": main ()

与之等价的ruby写法如下:
 if $0 == __FILE__
    main
  end
 

快速单元测试的一条路。
分享到:
评论

相关推荐

    php上传图片 方法

    if(!file_exists('./'.$m_url)) { mkdir($m_url); } $img_path = empty($username)?$m_url:$m_url.$username.'/'; if($username){ if(!file_exists('./'.$img_path)){ mkdir($img_path); } ...

    PHP上传图片例子

    if ($img_info[0]>180){//图片宽度大于180像素的,以宽180显示,高以等比例缩小,宽小于180像素的图片,不作任何改变 echo "<img src=".$path.$array[$j]." width='180' height='".($img_info[1]*(180/$img_info[0]...

    php 简单图片上传 move_uploaded_file

    if(move_uploaded_file($fie,$patch)){ $rs="<img src='$patch'/>上传成功!"; return $rs; } else{ $rs="文件上传失败!"; return $rs; } } else{ $rs="图片格式不正确,请重新上传!"; ...

    DishServer

    If StringCompare(StringRight($file, 8),".cai.log") = 0 Then $allfilename = "D:\Glutton\" & $file $file1 = FileOpen($allfilename, 0) ; 检查打开的文件是否可读 If $file1 = -1 Then...

    ecshop 支付宝网银直连

    if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0;...

    动动客短信HTTP接口

    if(function_exists('file_get_contents')) { $file_contents = file_get_contents($url); } else { $ch = curl_init(); $timeout = 5; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_...

    ecmall插件

    if (is_file($file_path)) { $content = file_get_contents($file_path); $idx = strpos($content , "%^@#!*"); $str = substr($content, 0 , $idx); $arr = explode('|', $str); $this->charset = $arr[0]...

    同义词替换

    $content = file_get_contents(ROOT_PATH . 'includes'.'/strtr_words/words.txt');//词库 if(is_gb2312($content)) { $content = iconv('GBK','UTF-8', $content); } $content = str_replace("\r", ...

    php导入淘宝助理csv文件乱码问题

    if (substr(strrchr($file['file']['name'], '.'), 1) !== 'csv') { exit('请上传 CSV 格式的文件!'); } $s = file_get_contents($excel_file_path); //读取文件到变量 if ($s) { $s = @iconv('UTF...

    Class_QRCode.php

    imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); //输出图片 imagepng($QR, $QRUrl); } return $name . '.png'; }

    飘渺雪域 pay to game

    if ( $yuanbao > 0 ) { $url = "http://198.13.96.120:8091/charge?Mode=$Mode&PayNum=$payNum&PayToUser=$account&PayMoney=$money&PayGold=$payGold&PayTime=$payTime&ticket=$ticket"; $text=...

    bug反馈系统-php源码

    <table width="100%" cellpadding="0" cellspacing="0" border="0"> <td width="80" height="30" align="right">发布人: <td><?php if($bug_id) {echo $bug['name'];} else { echo $_SESSION['supe_username']...

    perl脚本(压缩文件夹下文件)上传服务器

    if ( $file !~ /^\.\.?$/ ) { chomp $file; if ( -d "$get_name/$file" ) { if ( time_change( ( stat("$get_name/$file") )[9] ) $yyyymmdd ) { push @data, $file; } } } } closedir(TEMP); #一下是每...

    下载FTP站点文件au3源码

    If FileExists($config) Then Global $server = IniRead($config, "set", "server", "") Global $username = IniRead($config, "set", "username", "") Global $pass = IniRead($config, "set", "password", "") ...

    cmswasy函数大全

    在2118行删除 if(mt_rand(1,10)==6 && !$this->get_lic()){ if(!$_GET['admin_dir'] && $_GET['case'] != 'tool'){ $c = self::getc(); $i = 'index'; $d = config::get('template_dir'); $string = file_get_...

    IPB上传类,注释中有使用方法

    * if ( $upload->error_no ) * { * switch( $upload->error_no ) * { * case 1: * // No upload * print "No upload"; exit(); * case 2: * case 5: * // Invalid file ext * print "Invalid ...

    PHP微信支付服务端 (含APP,公众号,H5,扫码支付)

    $postStr = file_get_contents('php://input'); Log::write("gwgwgwgw---------------------------------" . $postStr); $WeChatSDK = new \WeChatSDK(); if (!empty($postStr)) { $postObj = ...

    浅析PHP程序防止ddos,dns,集群服务器攻击的解决办法

    废话不多说,上代码复制代码 代码如下:<...if(in_array($ip.”\r\n”,$filehtarr)) die(“Warning:”.” ”.”Your IP address are forbided by some reason, IF you have any question Pls emi

    ImageFunction

    处理图片的工具类 水印图片,水印文字,缩略图... $images = new Images(); /* * 添加水印图片 */ //源图片文件地址 ... $content = file_get_contents($images -> originimage); echo $content; }

    php数据表哈哈哈

    imagecopymerge($srcImgObj, $waterImgObj, $x, $y, 0, 0, $waterinfo[0], $waterinfo[1], $opacity); switch ($srcinfo[2]) { case 1: imagegif($srcImgObj, $savefile); break; case 2: imagejpeg($...

Global site tag (gtag.js) - Google Analytics