forked from hanlintao/translatorscanprogram
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path代码 6-15.php
More file actions
29 lines (29 loc) · 1.11 KB
/
代码 6-15.php
File metadata and controls
29 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php include "shared/head.php"; ?>
<?php
include "shared/conn.php";
mysqli_select_db( $conn,"fmprc" );
mysqli_query($conn,"set names 'utf8'");
$xml = simplexml_load_file("source.tmx");
$json = json_encode($xml);
$jsondata = json_decode($json,true);
foreach ($jsondata["body"]["tu"] as $tu)
{
$zh_CN=$tu["tuv"][0]["seg"];
$zh_CN=str_replace("'","\'",$zh_CN);
$en_US=$tu["tuv"][1]["seg"];
$en_US=str_replace("'","\'",$en_US);
$insert_sql="INSERT INTO tm(zh_CN,en_US) values('$zh_CN','$en_US')";
$import=mysqli_query($conn,$insert_sql);
if(!$import)
{
echo "<font color=red><b>插入失败: </b></font>".$zh_CN."<br>";
echo "<font color=red><b>插入失败: </b></font>".$en_US."<br>";
}
else
{
echo "插入成功: ".$zh_CN."<br>";
echo "插入成功: ".$en_US."<br>";
}
}
?>
<?php include "shared/foot.php" ?>