wbw_analyse.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. require_once "../path.php";
  3. require_once "../public/_pdo.php";
  4. require_once '../public/load_lang.php';
  5. require_once '../public/function.php';
  6. global $PDO;
  7. PDO_Connect("sqlite:"._FILE_DB_USER_WBW_);
  8. $query = "SELECT * from wbw where 1";
  9. $sth = $PDO->prepare($query);
  10. $sth->execute();
  11. // owner, word,book,para,wid,type,text
  12. $i=0;
  13. while($result = $sth->fetch(PDO::FETCH_ASSOC))
  14. {
  15. try {
  16. $xmlString = "<root>".$result["data"]."</root>";
  17. echo $xmlString."<br>";
  18. $xmlWord = simplexml_load_string($xmlString);
  19. $wordsList = $xmlWord->xpath('//word');
  20. foreach ($wordsList as $word) {
  21. $pali = $word->real->__toString();
  22. foreach ($word as $key => $value) {
  23. $strValue = $value->__toString();
  24. if($strValue !== "?" && $strValue !== "" && $strValue !== ".ctl."){
  25. switch ($key) {
  26. case 'type':
  27. case 'gramma':
  28. case 'mean':
  29. case 'org':
  30. case 'om':
  31. var_dump( array($result["owner"],$pali,$result["book"],$result["paragraph"],$result["wid"],$key,$strValue));
  32. break;
  33. }
  34. }
  35. }
  36. }
  37. } catch ( Throwable $e) {
  38. echo "Captured Throwable: " . $e->getMessage();
  39. }
  40. if($i>100){
  41. break;
  42. }
  43. else{
  44. $i++;
  45. }
  46. }
  47. ?>