我有一个看起来像这样的应用程序:
<BrowserRouter>
<Route path="/" component={Root} />
</BrowserRouter>
// Root.js
function Root() {
return (
<MemoryRouter>
<Switch>
<Route path="/" component={MemRoot} />
<Route path="/bar">
<Link to="/>To browser Root</Link>
</Route>
</MemoryRouter>
);
}
现在当我点击Link
时,它会更改MemoryRouter
的网址,但我真的希望改变{{1}的网址}。
如何告诉BrowserRouter
定位Link
?
答案 0 :(得分:0)
好的,你可以这样做。请参阅demo:
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['filename']['name']);
if(move_uploaded_file($_FILES['filename']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['filename']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>