当前位置: 首页>>代码示例>>PHP>>正文


PHP duplicate函数代码示例

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


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

示例1: duplicate

function duplicate($p, $f, $i)
{
    $fn = explode(".", $f);
    $fn[0] = $fn[0] . $i;
    $fn = implode(".", $fn);
    if (file_exists($p . $fn)) {
        duplicate($p, $f, ++$i);
    } else {
        full_copy($p . $f, $p . $fn);
    }
}
开发者ID:zntfdr,项目名称:blue-waterdrop,代码行数:11,代码来源:copy.php

示例2: param

     param('results_city_page', 'integer', '', true);
     param('results_city_order', 'string', '', true);
     // Redirect so that a reload doesn't write to the DB twice:
     header_redirect(regenerate_url('', '', '', '&'), 303);
     // Will EXIT
     // We have EXITed already at this point!!
     break;
 case 'new':
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     if (!isset($edited_City)) {
         // We don't have a model to use, start with blank object:
         $edited_City = new City();
     } else {
         // Duplicate object in order no to mess with the cache:
         $edited_City = duplicate($edited_City);
         // PHP4/5 abstraction
         $edited_City->ID = 0;
     }
     break;
 case 'csv':
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     break;
 case 'edit':
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Make sure we got an city_ID:
     param('city_ID', 'integer', true);
     break;
 case 'create':
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:cities.ctrl.php

示例3: unset

        unset($edited_UserfieldGroup);
        forget_param('ufgp_ID');
        $Messages->add(sprintf(T_('Requested «%s» object does not exist any longer.'), T_('User field group')), 'error');
        $action = 'nil';
    }
}
switch ($action) {
    case 'new':
        // Check permission:
        $current_User->check_perm('users', 'edit', true);
        if (!isset($edited_UserfieldGroup)) {
            // We don't have a model to use, start with blank object:
            $edited_UserfieldGroup = new UserfieldGroup();
        } else {
            // Duplicate object in order no to mess with the cache:
            $edited_UserfieldGroup = duplicate($edited_UserfieldGroup);
            // PHP4/5 abstraction
            $edited_UserfieldGroup->ID = 0;
        }
        break;
    case 'edit':
        // Check permission:
        $current_User->check_perm('users', 'edit', true);
        // Make sure we got an ufgp_ID:
        param('ufgp_ID', 'integer', true);
        break;
    case 'create':
        // Record new UserfieldGroup
    // Record new UserfieldGroup
    case 'create_new':
        // Record UserfieldGroup and create new
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:userfieldsgroups.ctrl.php

示例4: config_local

    exit;
}
if (isset($_GET["config-local"])) {
    config_local();
    exit;
}
if (isset($_GET["EditLocalDomain"])) {
    config_local_edit();
    exit;
}
if (isset($_GET["remote"])) {
    save_routage();
    exit;
}
if (isset($_GET["duplicate"])) {
    duplicate();
    exit;
}
if (isset($_GET["duplicate-server"])) {
    duplicate_save();
    exit;
}
if (isset($_GET["duplicate-delete"])) {
    duplicate_delete();
    exit;
}
if (isset($_GET["aliases"])) {
    aliases();
    exit;
}
if (isset($_GET["aliases-database"])) {
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:domains.relay.domains.php

示例5: clr

	}
*/
if ($_POST['oper'] == 'add') {
    $sql = "INSERT INTO {$table} \n\t           (compcode,source,paymode,description,ccode,glaccno,paytype,cardflag,recstatus,valexpdate,\n\t\t\t   lastuser,drpayment) \n\t\t\t   \n\t\t\tVALUES \n\t\t\t\t( '{$compcode}',\n\t\t\t\t'{$s}', \n\t\t\t\t'" . clr($_POST['paymode']) . "', \n\t\t\t\t'" . clr($_POST['description']) . "',\n\t\t\t\t'" . clr($_POST['ccode']) . "',\n\t\t\t\t'" . clr($_POST['glaccno']) . "', \n\t\t\t\t'" . clr($_POST['paytype']) . "', \n\t\t\t\t'" . clr($_POST['cardflag']) . "', \n\t\t\t\t'" . clr($_POST['recstatus']) . "', \n\t\t\t\t'" . clr($_POST['valexpdate']) . "',\n\t\t\t\t'" . clr($_POST['lastuser']) . "',\n\t\t\t\t'" . clr($_POST['drpayment']) . "'\n\t\t\t\t)";
    //'".clr($_POST['comrate'])."',
    //'".clr($_POST['lastupdate'])."',
    //'".clr($_POST['drcommrate'])."',
    //'".clr($_POST['cardcent'])."'
} else {
    if ($_POST['oper'] == 'edit') {
        $sql = "UPDATE {$table} SET\n\t\t\t\t\n\t\t\t\tdescription = '" . clr($_POST['description']) . "',\n\t\t\t\tccode = '" . clr($_POST['ccode']) . "',\n\t\t\t\tglaccno = '" . clr($_POST['glaccno']) . "',\n\t\t\t\tpaytype = '" . clr($_POST['paytype']) . "',\n\t\t\t\tcardflag = '" . clr($_POST['cardflag']) . "',\n\t\t\t\trecstatus = '" . clr($_POST['recstatus']) . "',\n\t\t\t\tvalexpdate = '" . clr($_POST['valexpdate']) . "',\n\t\t\t\tlastupdate = '{$user}',\n\t\t\t\tdrcommrate = '" . clr($_POST['drcommrate']) . "',\t\n\t\t\t\tdrpayment = '" . clr($_POST['drpayment']) . "',\n\t\t\t\tcardcent = '" . clr($_POST['cardcent']) . "'\n\t\t\t\t\t\t\n\t\t\tWHERE \n\t\t\t\tpaymode='{$_POST['paymode']}'";
    } else {
        if ($_POST['oper'] == 'del') {
            $sql = "DELETE FROM {$table} WHERE paymode='{$_POST['id']}'";
        }
    }
}
try {
    if ($_POST['oper'] == 'add' && duplicate('paymode', $table, clr($_POST['paymode']))) {
        throw new Exception('Duplicate key');
    }
    if (!$mysqli->query($sql)) {
        throw new Exception($sql);
    }
    $mysqli->commit();
} catch (Exception $e) {
    http_response_code(400);
    echo $e->getMessage();
    $mysqli->rollback();
}
$mysqli->close();
开发者ID:hairuLogic,项目名称:webms,代码行数:31,代码来源:paymentModeSave.php

示例6: duplicate

<?php

// duplicates a number
function duplicate($n)
{
    return $n * 2;
}
$valueToDuplicate = 10;
echo duplicate($valueToDuplicate);
开发者ID:iml-it,项目名称:compiler-example,代码行数:9,代码来源:normal_script.php

示例7: param

     param('results_curr_page', 'integer', '', true);
     param('results_curr_order', 'string', '', true);
     // Redirect so that a reload doesn't write to the DB twice:
     header_redirect(regenerate_url('', '', '', '&'), 303);
     // Will EXIT
     // We have EXITed already at this point!!
     break;
 case 'new':
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     if (!isset($edited_Currency)) {
         // We don't have a model to use, start with blank object:
         $edited_Currency = new Currency();
     } else {
         // Duplicate object in order no to mess with the cache:
         $edited_Currency = duplicate($edited_Currency);
         // PHP4/5 abstraction
         $edited_Currency->ID = 0;
     }
     break;
 case 'edit':
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Make sure we got an curr_ID:
     param('curr_ID', 'integer', true);
     break;
 case 'create':
     // Record new currency
 // Record new currency
 case 'create_new':
     // Record currency and create new
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:currencies.ctrl.php

示例8: duplicate

<?php

// What is wrong with the following code?
function duplicate($obj)
{
    $newObj = $obj;
    return $newObj;
}
$a = new MyClass();
$a_copy = duplicate($a);
$a->setValue(10);
$a_copy->setValue(20);
/*
1) You must use return &$newObj instead
2) There is nothing wrong with this code
3) duplicate() must accept its parameter by reference
4) You must use the clone operator to make a copy of an object									OK
5) duplicate() must return a reference
*/
开发者ID:milanchheda,项目名称:php-certification-training,代码行数:19,代码来源:0021.php

示例9: clr

    $sql = "INSERT INTO {$table} \n\t\t\t\t(compcode,glaccount,description,accgroup, recstatus, adduser,adddate) \n\t\t\tVALUES \n\t\t\t\t('{$compcode}', '" . clr($_POST['glaccount']) . "', '" . clr($_POST['description']) . "', '" . clr($_POST['accgroup']) . "', '" . clr($_POST['recstatus']) . "', '{$user}', NOW())";
    //(compcode,glaccount,description,acttype,repgroup,accgroup, recstatus, adduser,adddate, nprefid)
} else {
    if ($_POST['oper'] == 'edit') {
        if ($_POST['recstatus'] == 'D') {
            $sql = "UPDATE {$table} SET\n\t\t\t\t\tdescription = '" . clr($_POST['description']) . "',\n\t\t\t\t\trecstatus = 'D',\n\t\t\t\t\taccgroup = '" . clr($_POST['accgroup']) . "',\n\t\t\t\t\tdeluser= '{$user}', \n\t\t\t\t\tdeldate = NOW()\n\t\t\t\tWHERE \n\t\t\t\t\tsysno='{$_POST['sysno']}'";
        } else {
            $sql = "UPDATE {$table} SET\n\t\t\t\t\tdescription = '" . clr($_POST['description']) . "', \n\t\t\t\t\trecstatus = '" . clr($_POST['recstatus']) . "',\n\t\t\t\t\taccgroup = '" . clr($_POST['accgroup']) . "',\n\t\t\t\t\tupduser = '{$user}',\n\t\t\t\t\tupddate = NOW()\n\t\t\t\tWHERE \n\t\t\t\t\tsysno='{$_POST['sysno']}'";
            //echo"$sql";
        }
    } else {
        if ($_POST['oper'] == 'del') {
            $sql = "UPDATE {$table} SET  recstatus = 'D', deluser= '{$user}', deldate = NOW()\n\t\t WHERE sysno='{$_POST['id']}'";
        }
    }
}
try {
    if ($_POST['oper'] == 'add' && duplicate('glaccount', $table, clr($_POST['glaccount']))) {
        throw new Exception('Duplicate key');
    }
    //if($_POST['oper']=='add' && duplicate('compcode',$table,'$compcode') && duplicate('glaccount',$table,clr($_POST['glaccount']))){
    if (!$mysqli->query($sql)) {
        throw new Exception($sql);
    }
    $mysqli->commit();
} catch (Exception $e) {
    http_response_code(400);
    echo $e->getMessage();
    $mysqli->rollback();
}
$mysqli->close();
开发者ID:hairuLogic,项目名称:webms,代码行数:31,代码来源:GlMasterSave.php

示例10: templates

		$tpl=new templates();
		echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
		die();exit();
	}
	
	if(isset($_GET["tabs"])){tabs();exit;}
	if(isset($_GET["config"])){config();exit;}
	
	if(isset($_GET["config-local"])){config_local();exit;}
	if(isset($_GET["EditLocalDomain"])){config_local_edit();exit;}
	
	if(isset($_GET["trusted_smtp_domain"])){trusted_smtp_domain_save();exit;}
	if(isset($_GET["remote"])){save_routage();exit;}
	
	
	if(isset($_GET["duplicate"])){duplicate();exit;}
	if(isset($_GET["duplicate-server"])){duplicate_save();exit;}
	if(isset($_GET["duplicate-delete"])){duplicate_delete();exit;}
	
	
	
	if(isset($_GET["aliases"])){aliases();exit;}
	if(isset($_GET["aliases-database"])){aliases_database();exit;}
	if(isset($_GET["aliases-import"])){aliases_import_form();exit;}
	if(isset($_POST["aliases-import-perform"])){aliases_import_perform();exit;}
	if(isset($_POST["aliase-delete-perform"])){aliases_delete_perform();exit;}
	if(isset($_POST["aliase-empty-perform"])){aliases_empty_perform();exit;}
	
	
	
	
开发者ID:rsd,项目名称:artica-1.5,代码行数:27,代码来源:domains.relay.domains.php

示例11: unset

        unset($edited_Organization);
        forget_param('org_ID');
        $Messages->add(sprintf(T_('Requested &laquo;%s&raquo; object does not exist any longer.'), T_('Organization')), 'error');
        $action = 'nil';
    }
}
switch ($action) {
    case 'new':
        // Check permission:
        $current_User->check_perm('users', 'edit', true);
        if (!isset($edited_Organization)) {
            // We don't have a model to use, start with blank object:
            $edited_Organization = new Organization();
        } else {
            // Duplicate object in order no to mess with the cache:
            $edited_Organization = duplicate($edited_Organization);
            // PHP4/5 abstraction
            $edited_Organization->ID = 0;
        }
        break;
    case 'edit':
        // Check permission:
        $current_User->check_perm('users', 'edit', true);
        // Make sure we got an org_ID:
        param('org_ID', 'integer', true);
        break;
    case 'create':
        // Record new Organization
    // Record new Organization
    case 'create_new':
        // Record Organization and create new
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:organizations.ctrl.php

示例12: param

     param('results_subrg_page', 'integer', '', true);
     param('results_subrg_order', 'string', '', true);
     // Redirect so that a reload doesn't write to the DB twice:
     header_redirect(regenerate_url('', '', '', '&'), 303);
     // Will EXIT
     // We have EXITed already at this point!!
     break;
 case 'new':
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     if (!isset($edited_Subregion)) {
         // We don't have a model to use, start with blank object:
         $edited_Subregion = new Subregion();
     } else {
         // Duplicate object in order no to mess with the cache:
         $edited_Subregion = duplicate($edited_Subregion);
         // PHP4/5 abstraction
         $edited_Subregion->ID = 0;
     }
     break;
 case 'edit':
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     // Make sure we got an subrg_ID:
     param('subrg_ID', 'integer', true);
     break;
 case 'create':
     // Record new subregion
 // Record new subregion
 case 'create_new':
     // Record subregion and create new
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:subregions.ctrl.php

示例13: clr

// disable autocommit 'admin',NOW()
if ($_POST['oper'] == 'add') {
    $sql = "INSERT INTO {$table} \n\t\t\t\t(compcode,debtortycode,description,depccode,depglacc, actdebccode, actdebglacc,lastuser, lastupdate,\n\t\t\t\tregfees, typegrp, updpayername, updepisode, recstatus) \n\t\t\tVALUES \n\t\t\t\t('" . clr($compcode) . "',\n\t\t\t\t'" . clr($_POST['debtortycode']) . "',\n\t\t\t\t'" . clr($_POST['description']) . "', \n\t\t\t\t'" . clr($_POST['depccode']) . "',\n\t\t\t\t'" . clr($_POST['depglacc']) . "', \n\t\t\t\t'" . clr($_POST['actdebccode']) . "', \n\t\t\t\t'" . clr($_POST['actdebglacc']) . "', \n\t\t\t\t'" . clr($user) . "', \n\t\t\t\tNOW(),\n\t\t\t\t'" . clr($_POST['regfees']) . "', \n\t\t\t\t'" . clr($_POST['typegrp']) . "', \n\t\t\t\t'{$user}',\n\t\t\t\t'" . clr($_POST['updepisode']) . "',\n\t\t\t\t'{$recstatus}'\n\t\t\t\t)";
} else {
    if ($_POST['oper'] == 'edit') {
        if ($_POST['recstatus'] == 'D') {
            $sql = "UPDATE {$table} SET\n\t\t\t\tcompcode= '" . clr($compcode) . "',\n\t\t\t\tdescription = '" . clr($_POST['description']) . "',\n\t\t\t\tdepccode = '" . clr($_POST['depccode']) . "',\n\t\t\t\tdepglacc ='" . clr($_POST['depglacc']) . "',\n\t\t\t\tactdebccode = '" . clr($_POST['actdebccode']) . "',\n\t\t\t\tactdebglacc ='" . clr($_POST['actdebglacc']) . "',\n\t\t\t\tlastuser = '" . clr($user) . "', \n\t\t\t\tlastupdate = NOW(), \n\t\t\t\ttypegrp= '" . clr($_POST['typegrp']) . "', \n\t\t\t\trecstatus = 'D'\n\t\t\tWHERE \n\t\t\t\tdebtortycode='{$_POST['debtortycode']}'";
        } else {
            $sql = "UPDATE {$table} SET\n\t\t\t\t\tdescription = '" . clr($_POST['description']) . "',\n\t\t\t\t\tdepccode = '" . clr($_POST['depccode']) . "',\n\t\t\t\t\tdepglacc ='" . clr($_POST['depglacc']) . "',\n\t\t\t\t\tactdebccode = '" . clr($_POST['actdebccode']) . "',\n\t\t\t\t\tactdebglacc ='" . clr($_POST['actdebglacc']) . "',\n\t\t\t\t\tlastuser = '" . clr($user) . "', \n\t\t\t\t\tlastupdate = NOW(),\n\t\t\t\t\ttypegrp= '" . clr($_POST['typegrp']) . "',\n\t\t\t\t\trecstatus = '" . clr($_POST['recstatus']) . "'\n\t\t\t\tWHERE \n\t\t\t\t\tdebtortycode='{$_POST['debtortycode']}'";
            echo "{$sql}";
        }
    } else {
        if ($_POST['oper'] == 'del') {
            $sql = "DELETE FROM {$table} WHERE debtortycode='{$_POST['id']}'";
        }
    }
}
try {
    if ($_POST['oper'] == 'add' && duplicate('debtortycode', $table, clr($_POST['debtortycode']))) {
        throw new Exception('Duplicate key');
    }
    if (!$mysqli->query($sql)) {
        throw new Exception($sql);
    }
    $mysqli->commit();
} catch (Exception $e) {
    http_response_code(400);
    echo $e->getMessage();
    $mysqli->rollback();
}
$mysqli->close();
开发者ID:hairuLogic,项目名称:webms,代码行数:31,代码来源:debtorTypeSave.php

示例14: forget_param

        forget_param('goal_ID');
        $Messages->add(sprintf(T_('Requested &laquo;%s&raquo; object does not exist any longer.'), T_('Goal')), 'error');
        $action = 'nil';
    }
}
switch ($action) {
    case 'new':
    case 'copy':
        // Check permission:
        $current_User->check_perm('stats', 'edit', true);
        if (!isset($edited_Goal)) {
            // We don't have a model to use, start with blank object:
            $edited_Goal = new Goal();
        } else {
            // Duplicate object in order no to mess with the cache:
            $edited_Goal = duplicate($edited_Goal);
            // PHP4/5 abstraction
            $edited_Goal->ID = 0;
        }
        break;
    case 'edit':
        // Edit file type form...:
        // Check permission:
        $current_User->check_perm('stats', 'edit', true);
        // Make sure we got an ftyp_ID:
        param('goal_ID', 'integer', true);
        break;
    case 'create':
        // Record new goal
    // Record new goal
    case 'create_new':
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:goals.ctrl.php

示例15: GoalCategory

         }
     }
     break;
     // **** Categories **** //
 // **** Categories **** //
 case 'cat_new':
 case 'cat_copy':
     // New goal category form...:
     // Check permission:
     $current_User->check_perm('stats', 'edit', true);
     if (!isset($edited_GoalCategory)) {
         // We don't have a model to use, start with blank object:
         $edited_GoalCategory = new GoalCategory();
     } else {
         // Duplicate object in order no to mess with the cache:
         $edited_GoalCategory = duplicate($edited_GoalCategory);
         // PHP4/5 abstraction
         $edited_GoalCategory->ID = 0;
     }
     break;
 case 'cat_edit':
     // Edit goal category form...:
     // Check permission:
     $current_User->check_perm('stats', 'edit', true);
     // Make sure we got an ftyp_ID:
     param('gcat_ID', 'integer', true);
     break;
 case 'cat_create':
     // Record new goal category
 // Record new goal category
 case 'cat_create_new':
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:goals.ctrl.php


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