President Trump has signed legislation to reopen the government after Congress approved a federal spending plan.