Home > php教程 > php手册 > body text

Some previous problem solving records

WBOY
Release: 2016-11-30 23:59:39
Original
1061 people have browsed it

-------------------------html/css related-------------------- ---------------

The QR code at the bottom of the imitation Baidu/shrunk webpage is visible, and the text block on the right disappears. It turns out to be a width problem. Just change the width and make both divs 49%.

The li imitating Baidu/bottom will appear. Use list-style:none; for global processing. Put it in the body and it will be globally valid.
Use style="list-style-type:none", which is not very useful.
In the a tag The li inside can be valid, but the li inside p is invalid. It is better to use the global one

-------------------------FTP related WinSCP------------------------ ----------

I found a problem. When modifying ftp, there was no problem with the code, but it was always unsuccessful. Later I found out that it was a delay, and I changed the code, but ftp has not been updated yet, so it was always unsuccessful. It was a waste of time. Be sure to see the modification time in ftp before testing.

--------------------------WeChat development related-------------------- ---------------

WeChat development, graphic reply, put the public code in the controller into the new model file, create a new method in the new model, and put the public code into the method.
The definition in the instantiated model file in the controller is different depending on the thinkphp version. The video is version 3.1, and mine is 3.2.3. I couldn’t get it through the manual. The model definition in the manual needs to inherit model. This is the case of the operation table. , I didn’t use the database or tables at all, and finally removed the inheritance successfully.
Model code
namespace ImoocModel;
use ThinkModel;
class IndexModel
{ //Reply to WeChat messages with multiple image and text types
public function responseNews($postObj,$arr)
{

Controller code
namespace ImoocController;
use ThinkController;
class IndexController extends Controller
{
//instantiated model
$indexModel = new ImoocModelIndexModel();
$indexModel->responseNews($postObj,$arr);

---------------------------Virtual Host-------------------- ------------------

For projects arranged on the virtual host, accessing http://www.long.com/imooc.php/Index/http_curl is unsuccessful
Only http://www.long.com/imooc.php
The reason is that the default is Normal access mode //www.huqunlong.com/imooc.php&c=Index&a=http_curl Only in this way can you successfully access
Find the thinkphp configuration file convent.php to change the mode. Later, I found that setting pathinfo directly on the virtual host control panel page was successful.
Visit http://www.long.com/imooc.php/Index/http_curl successfully

---------------------------------memcached related-------------------- ----------

When installing memcached using cmd on Shenzhou Ares Z7M under Windows 10, an error occurred: failed to install service or service already installed

Solution:

1. Find the cmd.exe file (c:windowssystem32cmd.exe)

2. Right-click cmd.exe to run as administrator

Memcache installation under windows
1. Download the Windows stable version of memcache from Baidu, unzip it and put it in a disk, such as c:memcached
2. Enter 'c:memcachedmemcached.exe -d install' in the cmd command interface to install
3. Then enter: 'c:memcachedmemcached.exe -d start' to start. Right-click on the computer/Manage/Service/View memcached service has been started. The installation is successful

Note: In the future, memcached will be automatically started as a service of Windows every time you boot up. Default port: 11211.

If you want to uninstall, execute the following command:
1.memcached.exe -d stop
2.memcached.exe -d uninstall

memcache is installed under the D drive

When you want to use it, copy the files in memcache to the project file under WWW to use memcache

------------------------------Mysql related-------------------------- ------------------

PreparedStatement is a prepared statement that can improve database execution efficiency. PreparedStatement prevents SQL injection.

column 'id' in where clause is ambiguous

The column 'id' in the where clause is ambiguous. There is no indication of which table the id belongs to. The id field exists in multiple tables

echo $product->getLastSql(); Get the last executed sql statement, print the error sql statement, and execute it under the dos command, you will know where the sql statement went wrong, and change the sql statement according to the error.

1052:Column 'state' in where clause is ambiguous

Two tables have the same field state

DOS command line error under Windows 10: "mysql" is not an internal or external command of the system

Solution: Configure the bin directory of mysql to the system's path environment variable
Find the installation directory of MySQL, mine is D:phpStudyMySQLbin
Right-click Computer Properties/Advanced System Settings/Environment Variables/System Environment Variables/Path Environment Variables/Edit/Edit Text
Add at the end of the variable value;D:phpStudyMySQLbin

--------------------------------Thinkphp3.2.3 related----------------- ----------

HTML page added


php page
Thinkphp jumps to the original page after successful modification
Modification method
$surl=$_POST['surl'];
unset($_POST['surl']);
Add
$ren when jumping =$brand->where("id=$id")->data($_POST)->save();
if($ren===false)
{
$this->error( "Brand modification failed",$usrl);
}
else
{
$this->success("Brand modification successful",$surl);
}
You can jump back to the original modified page

-----------------------------zend studio related-------------------- ----------

zend studio 12.5 editor does not display line numbers

Solution: windows/general/editors/text editors/show line numbers

--------------------------mysql database related-------------------- ----------

Back up the database under Linux
Modify permissions chmod -R 777 /var Modify all permissions under var in the root directory
mysqldump -u root -p news>/var/new.sql Press Enter to enter the password Backup is successful

Backup database under windows/dos prompts that the client does not have the required privileges
Solution:
Find c:windowssystem32cmd.exe
Or start》All Programs》Attachments》Command Prompt
Right-click and select Run Mode, select Identity, and select Super Administrator Just run it.
The backup of C drive and D drive failed because they did not have the required privileges. So I changed it to E drive. Alas, it was successful!
mysqldump -u root -p 20160514>e:a.sql Enter Enter password Backup successful

show variables like 'character%' View database encoding settings

set names gbk; tells mysql to return the gbk encoding. The command window sets the encoding. The content in the database is utf8. The command window needs to set gbk

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!