In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how php can do exercises automatically. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The general idea of using php to realize automatic exercise in class workshop
The receptionist gets all the questions and marks them.
Record the answer in the background
Get the answer from the background and fill it in automatically
Realization principle
First of all, you can find that all the topics are pictures, but url has one thing in common, that is, imageType=2.
Then go directly to the code [recommended study: "PHP Video tutorial"]
Get the addresses of all the pictures and send them to the background. The background will receive the url addresses of all the pictures.
This is part of the source code. We'll talk about this getQuestionIdFromImageUrl later.
Then create a new database. I have built a database called kgc_cheater here.
And table question_answers
The following is the table structure
And using the Medoo/Medoo library as a database link
Then write a logic to get the answer from the database
You may wonder what maps is, because the operation of the image address in the foreground is different from that in the background.
Let me show you getQuestionIdFromImageUrl. You might understand.
Because it is found that the image address of each user is different, even if the title is the same, but the picture address of each account will not change, then it shows that the calculation of the picture address is regular. After studying for half a day, it is found that, in fact, the second part is subtracted from the specified offset value after the relativePath parameter is used / divided, and how to obtain it will be explained later.
We request the answer directly from the backend and return the maps and answers parameters
The definition of maps is actually $url = > $question_id.
Answers is defined as ['question_id' = > $question_id,' answer' = > $answer]
As shown in the figure, use 3 parent and then go to ul.sec2 to get the answer list, then find the element that contains the answer and click on it by simulation
In this way, an automatic answer is completed.
Going back to the above, for the acquisition of the offset value, look at your url when you log in
559634 is your offset. Go to the answer page.
This is the source address of the picture, https://tiku.kgc.cn/testing/cdn/getImage?relativePath=0069000/1543312740097/e19f21615ab8e9866619bf47c3b5b59c.jpg&imageType=2
The id of the original image is 0069000max 1543312740097.
Use the offset value to subtract the second parameter to get 1543312180463
Finally, we get the title id: 0069000Zero 1543312180463.
Other accounts can also get the same id through experiments, and then this is the actual id stored in the database.
When I enter the main page, I have a script to record this.
Save with cookies
Attach code
There is a correct answer in the parsing interface.
Each part is wrapped in .sec.post
Then fetch .sec2, get img and get url.
You can get the image id. You can also take relativePath, but you don't need to apply the offset value. You can just store it in the database.
Again, the answer is in .sec3 down. Pad 10 down in em:eq (0).
Take it like this directly.
Then send it to the backend and throw it into the database to record.
And send a recorded message at the front desk
Backend record code
Then there is the cooperation between the front and rear, automatically recording questions and answering questions automatically.
Finally, the exercise is done automatically.
After entering a test paper, fill it in automatically and add a code to update the test paper automatically, as shown in the figure
About the string of numbers after fuxiAuto
Enter first
Use the developer tool to find the start test button
_ javascript:unitExam (1098001001)
This 1098001001 is the subject id.
My last digit here is 1 to 7, so I wrote an automatic random number to randomly generate integers from 1 to 7.
The modification is also very simple.
Thank you for reading! This is the end of the article on "how to do exercises automatically in php". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.