There are 3 ways to take out a tank from close range.
The first is as Support, to use your C4's. 23 of them will destroy any armoured vehicle from full health.
The second is as Engineer, use the repair tool on the enemy vehicle to damage it fairly quickly.
The third is also as engineer, and just involves planting anti tank mines around it and hoping it drives onto one of them.