Template::delete PHP 메소드

delete() 공개 메소드

It does not take care on database info upgrade because it trusts of the cool Template::UpdateStatus() function.
public delete ( ) : mixed
리턴 mixed
    public function delete()
    {
        global $g_user;
        $rootDir = '/';
        if ($this->exists()) {
            $Path = dirname($rootDir . $this->getName());
            $Name = basename($this->getName());
            $fileFullPath = $this->getFullPath($Path, $Name);
            if (!self::InUse($this->getName())) {
                if (unlink($fileFullPath)) {
                    return true;
                }
            }
        }
        return false;
    }

Usage Example

function friendOrStranger($dataBase, $table, $receiver_id)
{
    //    $db = new Connect($dataBase,$table);
    $template = new Template();
    $check = $template->selectWhere($dataBase, $table, array('sender_id' => $_SESSION['userId'], 'receiver_id' => $receiver_id));
    if ($check) {
        $template->delete($dataBase, $table, $_SESSION['userId'], $receiver_id);
        $returnResult = 'Добави';
    } else {
        $template->insert($dataBase, $table, array('sender_id' => $_SESSION['userId'], 'receiver_id' => $receiver_id));
        $returnResult = 'Премахни';
    }
    return json_encode($returnResult);
}
All Usage Examples Of Template::delete