"Learn off" isn't even considered a phrasal verb. Nevertheless, I have heard such phrases as: "I learnt it off the computer"; "He was great person to learn off". Grammatically speaking, the preposition "from" should be used. "I've got to learn these words (off) by heart in a very short time" and "You have to learn these two pages (off) by heart by tomorrow morning", is correct. To sum up your query, the idiom "To learn something (off) by heart" means to memorize something perfectly. I hope this explanation helps.