二、输入:
代码: 全选
public function setFromKeys($fromkeys){
if(is_string($fromKeys)){
$fromKeys = (array)$fromKeys;
}
if(is_array($fromKeys)){
$this->arrFromKeys = $fromKeys;
}else{
throw new Exception('函数 Association::setFromKeys() 的参数 fromkeys 既不是数组也不是字符串');
}
}
代码: 全选
public function setToKeys($tokeys){
if(is_string($toKeys)){
$toKeys = (array)$toKeys;
}
if(is_array($toKeys)){
$this->arrToKeys = $toKeys;
}else{
throw new Exception('函数 Association::setToKeys() 的参数 tokeys 既不是数组也不是字符串');
}
}
代码: 全选
sed -e 's#From#To#g' -e 's#from#to#g' in.txt
我感觉我的方法太笨。有没有简洁一点的方法?