如何在php

时间:2016-08-09 13:45:38

标签: php mysql

我有以下html内容。

#SECTION#CHEMISTRY
#PART#chemistry1
#SINGLE#
1. This first Question is “Single Type” and contains data for chemistry1 chapter and Section was CHEMISTRY.
a. a
b. a
c. a
d. a
Ans. a
2. This second Question is “Single Type” and contains data for chemistry1 chapter and Section was CHEMISTRY.
a. b
b. b
c. b
d. b
Ans. b
3. This third Question is “Single Type” and contains data for chemistry1 chapter and Section was CHEMISTRY.
a. c
b. c
c. c
d. c
Ans. C
#ESSAY#
I felt the wall of the tunnel shiver. The master alarm squealed through my earphones. Almost simultaneously, Jack yelled down to me that there was a warning light on. Fleeting but spectacular sights snapped into ans out of view, the snow, the shower of debris, the moon, looming close and big, the dazzling sunshine for once unfiltered by layers of air. The last twelve hours before re-entry were particular bone-chilling. During this period, I had to go up in to command module. Even after the fiery re-entry splashing down in 81o water in south pacific, we could still see our frosty breath inside the command module.
4. The word 'Command Module' used twice in the given passage indicates perhaps that it deals with
a. an alarming journey
b. a commanding situation
c. a journey into outer space
d. a frightful battle.
Ans. C
5. Which one of the following reasons would one consider as more as possible for the warning lights to be on?
a. There was a shower of debris.
b. Jack was yelling.
c. A catastrophe was imminent.
d. The moon was looming close and big.
Ans. C
6. The statement that the dazzling sunshine was "for once unfiltered by layers of air" means
a. that the sun was very hot
b. that there was no strong wind
c. that the air was unpolluted
d. none of above
Ans. D
#END#
#MULTI#
7. Among the electrolytes Na2SO4, CaCl2, Al2(SO4)3 and NH4Cl, the most effective coagulating agent for Sb2S3 sol is [First Question for chemistry1 and CHEMISTRY]
a. Na2SO4
b. CaCl2
c. Al2(SO4)3
d. NH4Cl
Ans. C,a
Exp: Sb2S3 is an anionic sol, therefore cation of highest valency (Al3+ in the present case) would be most effective coagulating agent
8. Among the electrolytes Na2SO4, CaCl2, Al2(SO4)3 and NH4Cl, the most effective coagulating agent for Sb2S3 sol is [Second Question for chemistry1 and CHEMISTRY]
a. Na2SO4
b. CaCl2
c. Al2(SO4)3
d. NH4Cl
Ans. C,b
Exp: Sb2S3 is an anionic sol, therefore cation of highest valency (Al3+ in the present case) would be most effective coagulating agent
#PART#chemistry2
#TRUE / FALSE#
9. Among the electrolytes Na2SO4, CaCl2, Al2(SO4)3 and NH4Cl, the most effective coagulating agent for Sb2S3 sol is [First Question for chemistry2 and CHEMISTRY]
Ans. True
10. Among the electrolytes Na2SO4, CaCl2, Al2(SO4)3 and NH4Cl, the most effective coagulating agent for Sb2S3 sol is [Second Question for chemistry2 and CHEMISTRY]
Ans. False
#BLANKS#
11. Among the ____________ Na2SO4, CaCl2, Al2(SO4)3 and NH4Cl, the most effective coagulating agent for Sb2S3 sol is [third Question for chemistry2 and CHEMISTRY]
Ans. Electrolytes
12. Among the ____________ Na2SO4, CaCl2, Al2(SO4)3 and NH4Cl, the most effective coagulating agent for Sb2S3 sol is [fourth Question for chemistry2 and CHEMISTRY]
Ans. electrolytes

#SECTION#hindi
#PART#hindi1
#SINGLE#
#ESSAY#
शि‍क्षा : जवाहरलाल नेहरू को दुनिया के बेहतरीन स्कूलों और विश्वविद्यालयों में शिक्षा प्राप्त करने का मौका मिला था। उन्होंने अपनी स्कूली शिक्षा हैरो और कॉलेज की शिक्षा ट्रिनिटी कॉलेज, लंदन से पूरी की थी। उन्होंने अपनी लॉ की डिग्री कैम्ब्रिज विश्वविद्यालय से पूरी की।

हैरो और कैम्ब्रिज में पढ़ाई कर 1912 में नेहरूजी ने बार-एट-लॉ की उपाधि ग्रहण की और वे बार में बुलाए गए। पंडित नेहरू शुरू से ही गांधीजी से प्रभावित रहे और 1912 में कांग्रेस से जुड़े। 1920 के प्रतापगढ़ के पहले किसान मोर्चे को संगठित करने का श्रेय उन्हीं को जाता है। 1928 में लखनऊ में साइमन कमीशन के विरोध में नेहरू घायल हुए और 1930 के नमक आंदोलन में गिरफ्तार हुए। उन्होंने 6 माह जेल काटी। 1935 में अलमोड़ा जेल में 'आत्मकथा' लिखी। उन्होंने कुल 9 बार जेल यात्राएं कीं। उन्होंने विश्वभ्रमण किया और अंतरराष्ट्रीय नायक के रूप में पहचाने गए। 
योगदान : उन्होंने 6 बार कांग्रेस अध्यक्ष के पद (लाहौर 1929, लखनऊ 1936, फैजपुर 1937, दिल्ली 1951, हैदराबाद 1953 और कल्याणी 1954) को सुशोभित किया। 1942 के 'भारत छोड़ो' आंदोलन में नेहरूजी 9 अगस्त 1942 को बंबई में गिरफ्तार हुए और अहमदनगर जेल में रहे, जहां से 15 जून 1945 को रिहा किए गए। नेहरू ने पंचशील का सिद्धांत प्रतिपादित किया और 1954 में 'भारतरत्न' से अलंकृत हुए नेहरूजी ने तटस्थ राष्ट्रों को संगठित किया और उनका नेतृत्व किया।

सन् 1947 में भारत को आजादी मिलने पर जब भावी प्रधानमंत्री के लिए कांग्रेस में मतदान हुआ तो सरदार वल्लभभाई पटेल और आचार्य कृपलानी को सर्वाधिक मत मिले थे। किंतु महात्मा गांधी के कहने पर दोनों ने अपना नाम वापस ले लिया और जवाहरलाल नेहरू को प्रधानमंत्री बनाया गया। पंडित जवाहरलाल नेहरू 1947 में स्वतंत्र भारत के पहले प्रधानमंत्री बने। आजादी के पहले गठित अंतरिम सरकार में और आजादी के बाद 1947 में भारत के प्रधानमंत्री बने और 27 मई 1964 को उनके निधन तक इस पद पर बने रहे। 

नेहरू पाकिस्तान और चीन के साथ भारत के संबंधों में सुधार नहीं कर पाए। उन्होंने चीन की तरफ मित्रता का हाथ भी बढ़ाया, लेकिन 1962 में चीन ने धोखे से आक्रमण कर दिया। चीन का आक्रमण जवाहरलाल नेहरू के लिए एक बड़ा झटका था और शायद इसी वजह से उनकी मौत भी हुई। जवाहरलाल नेहरू को 27 मई 1964 को दिल का दौरा पडा़ जिसमें उनकी मृत्यु हो गई।

'स्वाधीनता और स्वाधीनता की लड़ाई को चलाने के लिए की जाने वाली कार्रवाई का खास प्रस्ताव तो करीब-करीब एकमत से पास हो गया। ...खास प्रस्ताव इत्तफाक से 31 दिसंबर की आधी रात के घंटे की चोट के साथ, जबकि पिछला साल गुजरकर उसकी जगह नया साल आ रहा था, मंजूर हुआ।' -लाहौर अधिवेशन में स्वतंत्रता प्रस्ताव पारित होने के बारे में नेहरू की 'मेरी कहानी' से।
उपसंहार : नेहरू के कार्यकाल में लोकतांत्रिक परंपराओं को मजबूत करना, राष्ट्र और संविधान के धर्मनिरपेक्ष चरित्र को स्थायी भाव प्रदान करना और योजनाओं के माध्यम से देश की अर्थव्यवस्था को सुचारु करना उनके मुख्य उद्देश्य रहे।
13. आपका मनपसंद कलर कौन सा है? [first in hindi]
a. लाल
b. हरा
c. पीला
d. नीला
Ans. D
14. आपका मनपसंद कलर कौन सा है? [second in hindi]
a. लाल
b. हरा
c. पीला
d. नीला
Ans. D
15. आपका मनपसंद कलर कौन सा है? [t in hindi]
a. लाल
b. हरा
c. पीला
d. नीला
Ans. D
#END#

#SECTION#english
#PART#english1
#MATCH#
16. Match the following: [first in match the following]
A. RC coupled amplifier          1. Very low drift
B. Tuned amplifier               2. 0
C. Chopper stabilized amplifier  3. 0
D. DC amplifier                  4. 0
a. A-4, B-3, C-1, D-2
b. A-3, B-4, C-2, D-1
c. A-3, B-4, C-1, D-2
d. A-4, B-3, C-2, D-1
Ans. c
17. Match the following: [second in match the following]
A. RC coupled amplifier   1. Very low drift
B. 0                      2. 0
C. 0                      3. 0
D. 0                      4. 0
a. A-4, B-3, C-1, D-2
b. A-3, B-4, C-2, D-1
c. A-3, B-4, C-1, D-2
d. A-4, B-3, C-2, D-1
Ans. c
18. Match the following: [first in match the following]
A.RC coupled amplifier        1. Very low drift
B.0                           2. 0
C.0                           3. 0
D.0                           4. 0
a. A-4, B-3, C-1, D-2
b. A-3, B-4, C-2, D-1
c. A-3, B-4, C-1, D-2
d. A-4, B-3, C-2, D-1
Ans. c
#PART#english2
#MATRIX#
19. Match the matrix: [first in matrix]
A.RC coupled amplifier     1. Very low drift
B.0                        2. 0
C.0                        3. 0
D.0                        4. 0
a. (A-4,2), (B-3,1), (C-1), (D-2)
b. (A-3), (B-4), (C-2,1), (D-1)
c. (A-3,2), (B-4), (C-1,4), (D-2)
d. (A-4), (B-3,4), (C-1,2), (D-1)
Ans. c
20. Match the matrix: [second in matrix]
A. RC coupled amplifier      1.      Very low drift
B. ₹0.00                     ₹2.00   ₹0.00
C. ₹0.00                     ₹3.00   ₹0.00
D. ₹0.00                     ₹4.00   ₹0.00
a. (A-4,2), (B-3,1), (C-1), (D-2)
b. (A-3), (B-4), (C-2,1), (D-1)
c. (A-3,2), (B-4), (C-1,4), (D-2)
d. (A-4), (B-3,4), (C-1,2), (D-1)
Ans. d

首先,我想解释一下我的文件中的单词。

  • SECTION:是一个主题名称。
  • PART:是一个章节名称。
  • SINGLE:是一个单一选择类型的问题。
  • MULTI:是一个多选类型的问题。**
  • TRUE / FALSE:是一个对错的类型问题。
  • BLANKS:填补空白类型问题。
  • MATCH:匹配以下类型的问题。
  • MATRIX:匹配矩阵类型问题。
  • ESSAY:是一个综合或链接类型的问题。
  • END:综合类型问题的结束。

根据要求,我必须导入.html文件并获取它的内容。我必须将数据插入数据库后。

为此,我尝试了以下代码:

<?php
    include "../../includes/timezone.php";  
    session_start();

    $FileType = isset($_REQUEST["FileType"]) ? $_REQUEST["FileType"] : "";
    $FormatType = isset($_REQUEST["FormatType"]) ? $_REQUEST["FormatType"] : "";
    $questionFormat = isset($_REQUEST["questionFormat"]) ? $_REQUEST["questionFormat"] : "";
    $optionFormat = isset($_REQUEST["optionFormat"]) ? $_REQUEST["optionFormat"] : "";
    $answerFormat = isset($_REQUEST["answerFormat"]) ? $_REQUEST["answerFormat"] : "";
    $ExplanationFormat = isset($_REQUEST["ExplanationFormat"]) ? $_REQUEST["ExplanationFormat"] : "";
    $answerDisplay = isset($_REQUEST["answerDisplay"]) ? $_REQUEST["answerDisplay"] : "";

    $FileName = 'file';
    $Destination = '../../../uploaded/importquestion/';

    $fileName = $_FILES[$FileName]["name"]; 
    $fileTmpLoc = $_FILES[$FileName]["tmp_name"];
    $temp = explode(".", $_FILES[$FileName]["name"]);
    $extension = end($temp);
    $temp = explode('.', $fileName);
    $ext = array_pop($temp);
    $name = implode('.', $temp);
    $time1 = time();

    $inputFileName =  str_replace(".html","",$fileName)."_".$time1.".".$extension;
    $path = $Destination.$inputFileName;
    move_uploaded_file($_FILES[$FileName]["tmp_name"], $path);
    $inputFile = '../../../uploaded/importquestion/'.$inputFileName;

    require_once __DIR__ . '/PhpWord/PhpWord/Autoloader.php';
    /***   Header file   ***/
    use PhpOffice\PhpWord\Autoloader;
    use PhpOffice\PhpWord\Settings;

    error_reporting(E_ALL);
    define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php'));
    define('IS_INDEX', SCRIPT_FILENAME == 'index');

    Autoloader::register();
    Settings::loadConfig();

    $writers = array('HTML' => 'html');
    $pageHeading = str_replace('_', ' ', SCRIPT_FILENAME);
    $pageTitle = IS_INDEX ? 'Welcome to ' : "{$pageHeading} - ";
    $pageTitle .= 'PHPWord';
    $pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>";

    $html = file_get_contents($inputFile);

    // a new dom object

    $dom = new domDocument; 
    libxml_use_internal_errors(true) AND libxml_clear_errors(); 

    // load the html into the object

    $doc = new DOMDocument();
    $doc->loadHTMLFile($inputFile);
    $htmlContent = $doc -> saveHTML();

    /* Division for Section */

    $sections = explode("#SECTION#",$htmlContent);

    for($s = 1; $s < count($sections); $s++){
        $subjectName = $sections[$s];
        $lessons = explode("#PART#",$subjectName);

        /* Division for Lesson */

        for($l = 1; $l < count($lessons); $l++){
            $lessonName = $lessons[$l];

            /* Division for Question Type */

            /* Check If Lesson Contains Single Type Questions */
            if(strpos($lessonName, '#SINGLE#') !== false) {
                $single = explode("#",$lessonName);
                /* Check If Questions has Comprehensive OR NOT*/

                if(strpos($lessonName, '#ESSAY#') !== false) {
                    // essay found
                }
            }

            /* Check If Lesson Contains Multi Type Questions */
            if(strpos($lessonName, '#MULTI#') !== false) {
            }

            /* Check If Lesson Contains True OR False Type Questions */
            if(strpos($lessonName, '#TRUE / FALSE#') !== false) {
            }

            /* Check If Lesson Contains Fill in the Blanks Type Questions */
            if(strpos($lessonName, '#BLANKS#') !== false) {
            }

            /* Check If Lesson Contains Match The Following Type Questions */
            if(strpos($lessonName, '#MATCH#') !== false) {
            }

            /* Check If Lesson Contains Match The Matrix Type Questions */
            if(strpos($lessonName, '#MATRIX#') !== false) {
            }
        }
    }   
?>

但是有一个问题是如何使用代码获得不同类型的问题?如何在特定类型问题中获得总问题?

实施例。在&#34;化学&#34;科有&#34;化学1&#34;章节名称共有6个单选题型和2个多选题型。

请指导我如何根据问题类型循环整个问题,因为不同的问题类型有不同的表格要插入。

提前谢谢大家。我非常感谢您的回答。

0 个答案:

没有答案