话说这篇文章真是在没有任何实例的情况下帮了大忙
另外附上我自己的一个完整demo:https://github.com/LearnForInterest/material
结合了ci框架的doctrine使用
原文地址:http://www.xuejiehome.com/blread-1920.html#index_6
一、配置数据库
二、创建和生成数据库表结构
三、从已有数据库生成Entity
四、保存数据到数据库
五、从数据库读取
六、更新记录
七、删除记录
八、工作笔记记录(可跳过):
Symfony和Doctrine进行了集成,Doctrine类库全部目标就是给你一个强大的工具,让你的工作更加容易。
Doctrine是完全解耦与Symfony的,所以并不一定要使用它。
一个简单例子:一个产品,我们首先来配置数据库,创建一个Product对象,添加到数据库并把它读回来。
首先,我们需要创建一个bundle:
| 1 | $php app/console generate:bundle --namespace=Blog/StoreBundle | 
 
 
 
一、配置数据库
  在开始之前,首先需要配置数据库连接信息。根据惯例,这些信息通常会配置在app/config/parameters.yml 文件中。
| 01 | #app/config/parameters.yml | 
 
| 02 | # This file is auto-generated during the composer install | 
 
| 04 |     mailer_transport: smtp | 
 
| 05 |     mailer_host: 127.0.0.1 | 
 
| 09 |     secret: 256d7de0d269e37752b49fec38f5fc5e | 
 
| 11 |     debug_redirects: false | 
 
| 12 |     use_assetic_controller: true | 
 
| 15 |     database_driver: pdo_mysql | 
 
| 16 |     database_host: 127.0.0.1 | 
 
| 18 |     database_name: symfony | 
 
| 20 |     database_password: 123 | 
 
 
 
将配置信息定义到parameters.yml文件中也是一个常用的做法。定义在该文件中的配置信息将会被主配置文件在安装Doctrine时引用。
| 01 | #app/config/doctrine.yml | 
 
| 03 | # Doctrine Configuration | 
 
| 06 |         default_connection: default | 
 
| 09 |                 driver:     "%database_driver%" | 
 
| 10 |                 host:       "%database_host%" | 
 
| 11 |                 port:       "%database_port%" | 
 
| 12 |                 user:       "%database_user%" | 
 
| 13 |                 password:   "%database_password%" | 
 
| 15 |                 dbname:     "%database_name%" | 
 
| 17 |         # if using pdo_sqlite as your database driver, add the path in parameters.yml | 
 
| 18 |         # e.g. database_path: "%kernel.root_dir%/data/data.db3" | 
 
| 19 |         # path:     "%database_path%" | 
 
| 22 |         auto_generate_proxy_classes: "%kernel.debug%" | 
 
 
 
以上文件中dbal和orm中的default均可以复制后更改以实现多个数据库链接。
在config.yml中导入上面的两个yml配置文件:
| 4 |     - { resource: parameters.yml } | 
 
| 5 |     - { resource: doctrine.yml } | 
 
| 6 |     - { resource: security.yml } | 
 
 
 
通过把数据库信息分离到一个特定的文件中,你可以很容易的为每个服务器保存不同的版本。现在Doctrine知道你的数据库配置了,你可以用它来创建一个数据库了。
二、创建和生成数据库表结构
(1)创建数据库
| 1 | $php app/console doctrine:database:create —em=“default” | 
 
 
 
执行上面命令的时候可能会出现“[DoctrineDBALExceptionConnectionException]An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory ”的错误,将database_host由localhost改为127.0.0.1即可。
(2)通过entity生成数据库表结构
创建基础的Entity实体类:
  假设你创建一个应用程序,其中有些产品需要展示。即时不考虑Doctrine或者数据库,你也应该知道你需要一个Product对象来表现这些产品。在你的StoreBundle的Entity目录下创建一个实体类(Entity)。
| 01 | // src/Blog/StoreBundle/Entity/Product.php | 
 
| 03 | namespace Blog\StoreBundle\Entity; | 
 
| 09 |     protected$description; | 
 
 
 
  这样的类经常被称为“Entity”,把表中的字段映射到该类。不过现在它还不能被保存到数据库中,因为现在它只不过还是个简单的PHP类。一旦你学习了Doctrine背后的概念,你可以让Doctrine来为你创建实体类。
       创建完整的Entity实体类:
| 1 | php app/console doctrine:generate:entity --entity="StoreBundle:Product"--fields="name:string(255) price:float description:text"--with-repository | 
 
 
 
| 001 | // src/Blog/StoreBundle/Entity/Product.php | 
 
| 005 | namespace Blog\StoreBundle\Entity; | 
 
| 007 | useDoctrineORMMapping asORM; | 
 
| 013 |  * @ORMEntity(repositoryClass="BlogStoreBundleEntityProductRepository") | 
 
| 020 |      * @ORMColumn(name="id", type="integer") | 
 
| 022 |      * @ORMGeneratedValue(strategy="AUTO") | 
 
| 029 |      * @ORMColumn(name="name", type="string", length=255) | 
 
| 036 |      * @ORMColumn(name="price", type="float") | 
 
| 043 |      * @ORMColumn(name="description", type="text") | 
 
| 045 |     private$description; | 
 
| 053 |     publicfunctiongetId() | 
 
| 061 |      * @param string $name | 
 
| 064 |     publicfunctionsetName($name) | 
 
| 076 |     publicfunctiongetName() | 
 
| 084 |      * @param float $price | 
 
| 087 |     publicfunctionsetPrice($price) | 
 
| 089 |         $this->price = $price; | 
 
| 099 |     publicfunctiongetPrice() | 
 
| 107 |      * @param string $description | 
 
| 110 |     publicfunctionsetDescription($description) | 
 
| 112 |         $this->description = $description; | 
 
| 122 |     publicfunctiongetDescription() | 
 
| 124 |         return$this->description; | 
 
 
 
根据Entity生成数据库:
| 1 | php app/console doctrine:schema:update --force --em="default" | 
 
 
 
看到如下提示即为成功:
Updating database schema...
Database schema updated successfully! "1" queries were executed
三、从已有数据库生成Entity
| 2 | php app/console doctrine:mapping:import--force StoreBundle annotation | 
 
| 3 | #根据数据库结构生成Product表的Entity | 
 
| 4 | app/console doctrine:mapping:import--em="default"StoreBundle --filter=Product annotation | 
 
| 6 | php app/console doctrine:generate:entities BlogStoreBundle | 
 
 
 
注意:
(1)--em="default"中的default是指connection,对应第一步配置数据库信息(doctrine.yml)中的default
(2)--filter=Product 这里的P是大写的,它的规则跟生成的类名是一致的(采用驼峰型)
例如:
| 1 | 表名: article             --filter=Article | 
 
| 2 | 表名:test_article         --filter=TestArticle | 
 
| 3 | 表名:test_article_detail  --filter=TestArticleDetail | 
 
 
 
四、保存数据到数据库
| 01 | // src/Blog/TestBundle/Controller/DefaultController.php | 
 
| 04 | useBlog\StoreBundle\Entity\Product; | 
 
| 06 | useSymfony\Component\HttpFoundation\Response; | 
 
| 07 | useSymfony\Bundle\FrameworkBundle\Controller\Controller; | 
 
| 10 | publicfunctioncreateAction() | 
 
| 12 |     $product= newProduct(); | 
 
| 13 |     $product->setName('A Foo Bar'); | 
 
| 14 |     $product->setPrice('19.99'); | 
 
| 15 |     $product->setDescription('Lorem ipsum dolor'); | 
 
| 17 |     $em= $this->getDoctrine()->getManager(); | 
 
| 19 |     $em->persist($product); | 
 
| 22 |     returnnewResponse('Created product id '.$product->getId()); | 
 
 
 
配置路由:
| 1 | #src/Blog/TestBundle/Resources/config/routing.yml | 
 
| 5 |     defaults: { _controller: TestBundle:Default:create } | 
 
 
 
 
五、从数据库读取
| 01 | publicfunctionshowAction($id) | 
 
| 03 |        $product= $this->getDoctrine() | 
 
| 04 |                  ->getRepository('AcmeStoreBundle:Product') | 
 
| 07 |              throw$this->createNotFoundException('No product found for id '.$id); | 
 
| 09 |        //do something,想把$product对象传递给一个template等。 | 
 
 
 
配置路由:
| 1 | #src/Blog/TestBundle/Resources/config/routing.yml | 
 
| 5 |     defaults: { _controller: TestBundle:Default:show } | 
 
 
 
其他查询方式可参考:Symfony2 Doctrine 数据库查询方法总结
六、更新记录
| 01 | publicfunctionupdateAction($id) | 
 
| 03 |     $em= $this->getDoctrine()->getEntityManager(); | 
 
| 04 |     $product= $em->getRepository('AcmeStoreBundle:Product')->find($id); | 
 
| 07 |         throw$this->createNotFoundException('No product found for id '.$id); | 
 
| 10 |     $product->setName('New product name!'); | 
 
| 13 |     return$this->redirect($this->generateUrl('homepage')); | 
 
 
 
更新记录仅需要三步:
1. 从Doctrine找到对象
2. 修改这个对象
3. 调用entity manager的flush函数
注意:
$em->persist($product)没有必要,这个方法仅仅是要告诉Doctrine去管理或者观看$product对象,当你从Doctrine中找到了$product对象,它已经被管理了。
Notice that calling $em->persist($product) isn't necessary. Recall that this method simply tells
Doctrine to manage or "watch" the $product object. In this case, since you fetched the $product object
from Doctrine, it's already managed.
七、删除记录
八、工作笔记记录(可跳过):
1. 增加记录:
     1.1 单表增加
| 01 | useAcme\StoreBundle\Entity\Product; | 
 
| 03 | publicfunctioncreateAction() | 
 
| 05 |     $product= newProduct(); | 
 
| 06 |     $product->setName('A Foo Bar'); | 
 
| 07 |     $product->setPrice('19.99'); | 
 
| 08 |     $product->setDescription('Lorem ipsum dolor'); | 
 
| 09 |     $em= $this->getDoctrine()->getManager(); | 
 
| 10 |     $em->persist($product); | 
 
| 12 |     returnnewResponse('Created product id '.$product->getId()); | 
 
 
 
     1.2 多表增加
| 01 | useAcme\StoreBundle\Entity\Category; | 
 
| 02 | useAcme\StoreBundle\Entity\Product; | 
 
| 04 | useSymfony\Component\HttpFoundation\Response; | 
 
| 05 | classDefaultController extendsController | 
 
| 07 |     publicfunctioncreateProductAction() | 
 
| 09 |         $category= newCategory(); | 
 
| 10 |         $category->setName('Main Products'); | 
 
| 11 |         $product= newProduct(); | 
 
| 12 |         $product->setName('Foo'); | 
 
| 13 |         $product->setPrice(19.99); | 
 
| 14 |         // relate this product to the category | 
 
| 15 |         $product->setCategory($category); | 
 
| 16 |         $em= $this->getDoctrine()->getManager(); | 
 
| 17 |         $em->persist($category); | 
 
| 18 |         $em->persist($product); | 
 
| 21 |         'Created product id: '.$product->getId() | 
 
| 22 |         .' and category id: '.$category->getId() | 
 
 
 
     1.3 批量插入函数
| 08 | functionucWords($str) | 
 
| 10 |     $str= ucwords(str_replace('_', ' ', $str)); | 
 
| 11 |     $str= str_replace(' ', '', $str); | 
 
| 19 | * @param string $entity | 
 
| 20 | * @param array $dataList | 
 
| 23 | functionbatchInsertByEntity($entity, $dataList, $per= 1000) | 
 
| 25 |     $count= count($dataList); | 
 
| 26 |     for($i= 0; $i< $count; $i++) { | 
 
| 28 |         foreach($dataList[$i] as$k=> $v) { | 
 
| 29 |         $obj->{"set". $this->ucWords($k)}($v); | 
 
| 31 |         $this->em->persist($obj); | 
 
| 32 |         if(($count% $per) === 0) { | 
 
 
 
(2)删除记录:
| 01 | publicfunctiondeleteAction($id) | 
 
| 03 |     $em= $this->getDoctrine()->getManager(); | 
 
| 04 |     $product= $em->getRepository('AcmeStoreBundle:Product')->find($id); | 
 
| 07 |         throw$this->createNotFoundException( | 
 
| 08 |         'No product found for id '.$id | 
 
| 12 |     $em->remove($product);  //注意:此处是remove函数 | 
 
| 14 |     return$this->redirect($this->generateUrl('homepage')); | 
 
 
 
(3)查询记录:
参看这篇文章:Symfony2 Doctrine 数据库查询方法总结
一、配置数据库
二、创建和生成数据库表结构
三、从已有数据库生成Entity
四、保存数据到数据库
五、从数据库读取
六、更新记录
七、删除记录
八、工作笔记记录(可跳过):
Symfony和Doctrine进行了集成,Doctrine类库全部目标就是给你一个强大的工具,让你的工作更加容易。
Doctrine是完全解耦与Symfony的,所以并不一定要使用它。
一个简单例子:一个产品,我们首先来配置数据库,创建一个Product对象,添加到数据库并把它读回来。
首先,我们需要创建一个bundle:
| 1 | $php app/console generate:bundle --namespace=Blog/StoreBundle | 
 
 
 
一、配置数据库
  在开始之前,首先需要配置数据库连接信息。根据惯例,这些信息通常会配置在app/config/parameters.yml 文件中。
| 01 | #app/config/parameters.yml | 
 
| 02 | # This file is auto-generated during the composer install | 
 
| 04 |     mailer_transport: smtp | 
 
| 05 |     mailer_host: 127.0.0.1 | 
 
| 09 |     secret: 256d7de0d269e37752b49fec38f5fc5e | 
 
| 11 |     debug_redirects: false | 
 
| 12 |     use_assetic_controller: true | 
 
| 15 |     database_driver: pdo_mysql | 
 
| 16 |     database_host: 127.0.0.1 | 
 
| 18 |     database_name: symfony | 
 
| 20 |     database_password: 123 | 
 
 
 
将配置信息定义到parameters.yml文件中也是一个常用的做法。定义在该文件中的配置信息将会被主配置文件在安装Doctrine时引用。
| 01 | #app/config/doctrine.yml | 
 
| 03 | # Doctrine Configuration | 
 
| 06 |         default_connection: default | 
 
| 09 |                 driver:     "%database_driver%" | 
 
| 10 |                 host:       "%database_host%" | 
 
| 11 |                 port:       "%database_port%" | 
 
| 12 |                 user:       "%database_user%" | 
 
| 13 |                 password:   "%database_password%" | 
 
| 15 |                 dbname:     "%database_name%" | 
 
| 17 |         # if using pdo_sqlite as your database driver, add the path in parameters.yml | 
 
| 18 |         # e.g. database_path: "%kernel.root_dir%/data/data.db3" | 
 
| 19 |         # path:     "%database_path%" | 
 
| 22 |         auto_generate_proxy_classes: "%kernel.debug%" | 
 
 
 
以上文件中dbal和orm中的default均可以复制后更改以实现多个数据库链接。
在config.yml中导入上面的两个yml配置文件:
| 4 |     - { resource: parameters.yml } | 
 
| 5 |     - { resource: doctrine.yml } | 
 
| 6 |     - { resource: security.yml } | 
 
 
 
通过把数据库信息分离到一个特定的文件中,你可以很容易的为每个服务器保存不同的版本。现在Doctrine知道你的数据库配置了,你可以用它来创建一个数据库了。
二、创建和生成数据库表结构
(1)创建数据库
| 1 | $php app/console doctrine:database:create —em=“default” | 
 
 
 
执行上面命令的时候可能会出现“[DoctrineDBALExceptionConnectionException]An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory ”的错误,将database_host由localhost改为127.0.0.1即可。
(2)通过entity生成数据库表结构
创建基础的Entity实体类:
  假设你创建一个应用程序,其中有些产品需要展示。即时不考虑Doctrine或者数据库,你也应该知道你需要一个Product对象来表现这些产品。在你的StoreBundle的Entity目录下创建一个实体类(Entity)。
| 01 | // src/Blog/StoreBundle/Entity/Product.php | 
 
| 03 | namespace Blog\StoreBundle\Entity; | 
 
| 09 |     protected$description; | 
 
 
 
  这样的类经常被称为“Entity”,把表中的字段映射到该类。不过现在它还不能被保存到数据库中,因为现在它只不过还是个简单的PHP类。一旦你学习了Doctrine背后的概念,你可以让Doctrine来为你创建实体类。
       创建完整的Entity实体类:
| 1 | php app/console doctrine:generate:entity --entity="StoreBundle:Product"--fields="name:string(255) price:float description:text"--with-repository | 
 
 
 
| 001 | // src/Blog/StoreBundle/Entity/Product.php | 
 
| 005 | namespace Blog\StoreBundle\Entity; | 
 
| 007 | useDoctrineORMMapping asORM; | 
 
| 013 |  * @ORMEntity(repositoryClass="BlogStoreBundleEntityProductRepository") | 
 
| 020 |      * @ORMColumn(name="id", type="integer") | 
 
| 022 |      * @ORMGeneratedValue(strategy="AUTO") | 
 
| 029 |      * @ORMColumn(name="name", type="string", length=255) | 
 
| 036 |      * @ORMColumn(name="price", type="float") | 
 
| 043 |      * @ORMColumn(name="description", type="text") | 
 
| 045 |     private$description; | 
 
| 053 |     publicfunctiongetId() | 
 
| 061 |      * @param string $name | 
 
| 064 |     publicfunctionsetName($name) | 
 
| 076 |     publicfunctiongetName() | 
 
| 084 |      * @param float $price | 
 
| 087 |     publicfunctionsetPrice($price) | 
 
| 089 |         $this->price = $price; | 
 
| 099 |     publicfunctiongetPrice() | 
 
| 107 |      * @param string $description | 
 
| 110 |     publicfunctionsetDescription($description) | 
 
| 112 |         $this->description = $description; | 
 
| 122 |     publicfunctiongetDescription() | 
 
| 124 |         return$this->description; | 
 
 
 
根据Entity生成数据库:
| 1 | php app/console doctrine:schema:update --force --em="default" | 
 
 
 
看到如下提示即为成功:
Updating database schema...
Database schema updated successfully! "1" queries were executed
三、从已有数据库生成Entity
| 2 | php app/console doctrine:mapping:import--force StoreBundle annotation | 
 
| 3 | #根据数据库结构生成Product表的Entity | 
 
| 4 | app/console doctrine:mapping:import--em="default"StoreBundle --filter=Product annotation | 
 
| 6 | php app/console doctrine:generate:entities BlogStoreBundle | 
 
 
 
注意:
(1)--em="default"中的default是指connection,对应第一步配置数据库信息(doctrine.yml)中的default
(2)--filter=Product 这里的P是大写的,它的规则跟生成的类名是一致的(采用驼峰型)
例如:
| 1 | 表名: article             --filter=Article | 
 
| 2 | 表名:test_article         --filter=TestArticle | 
 
| 3 | 表名:test_article_detail  --filter=TestArticleDetail | 
 
 
 
四、保存数据到数据库
| 01 | // src/Blog/TestBundle/Controller/DefaultController.php | 
 
| 04 | useBlog\StoreBundle\Entity\Product; | 
 
| 06 | useSymfony\Component\HttpFoundation\Response; | 
 
| 07 | useSymfony\Bundle\FrameworkBundle\Controller\Controller; | 
 
| 10 | publicfunctioncreateAction() | 
 
| 12 |     $product= newProduct(); | 
 
| 13 |     $product->setName('A Foo Bar'); | 
 
| 14 |     $product->setPrice('19.99'); | 
 
| 15 |     $product->setDescription('Lorem ipsum dolor'); | 
 
| 17 |     $em= $this->getDoctrine()->getManager(); | 
 
| 19 |     $em->persist($product); | 
 
| 22 |     returnnewResponse('Created product id '.$product->getId()); | 
 
 
 
配置路由:
| 1 | #src/Blog/TestBundle/Resources/config/routing.yml | 
 
| 5 |     defaults: { _controller: TestBundle:Default:create } | 
 
 
 
 
五、从数据库读取
| 01 | publicfunctionshowAction($id) | 
 
| 03 |        $product= $this->getDoctrine() | 
 
| 04 |                  ->getRepository('AcmeStoreBundle:Product') | 
 
| 07 |              throw$this->createNotFoundException('No product found for id '.$id); | 
 
| 09 |        //do something,想把$product对象传递给一个template等。 | 
 
 
 
配置路由:
| 1 | #src/Blog/TestBundle/Resources/config/routing.yml | 
 
| 5 |     defaults: { _controller: TestBundle:Default:show } | 
 
 
 
其他查询方式可参考:Symfony2 Doctrine 数据库查询方法总结
六、更新记录
| 01 | publicfunctionupdateAction($id) | 
 
| 03 |     $em= $this->getDoctrine()->getEntityManager(); | 
 
| 04 |     $product= $em->getRepository('AcmeStoreBundle:Product')->find($id); | 
 
| 07 |         throw$this->createNotFoundException('No product found for id '.$id); | 
 
| 10 |     $product->setName('New product name!'); | 
 
| 13 |     return$this->redirect($this->generateUrl('homepage')); | 
 
 
 
更新记录仅需要三步:
1. 从Doctrine找到对象
2. 修改这个对象
3. 调用entity manager的flush函数
注意:
$em->persist($product)没有必要,这个方法仅仅是要告诉Doctrine去管理或者观看$product对象,当你从Doctrine中找到了$product对象,它已经被管理了。
Notice that calling $em->persist($product) isn't necessary. Recall that this method simply tells
Doctrine to manage or "watch" the $product object. In this case, since you fetched the $product object
from Doctrine, it's already managed.
七、删除记录
八、工作笔记记录(可跳过):
1. 增加记录:
     1.1 单表增加
| 01 | useAcme\StoreBundle\Entity\Product; | 
 
| 03 | publicfunctioncreateAction() | 
 
| 05 |     $product= newProduct(); | 
 
| 06 |     $product->setName('A Foo Bar'); | 
 
| 07 |     $product->setPrice('19.99'); | 
 
| 08 |     $product->setDescription('Lorem ipsum dolor'); | 
 
| 09 |     $em= $this->getDoctrine()->getManager(); | 
 
| 10 |     $em->persist($product); | 
 
| 12 |     returnnewResponse('Created product id '.$product->getId()); | 
 
 
 
     1.2 多表增加
| 01 | useAcme\StoreBundle\Entity\Category; | 
 
| 02 | useAcme\StoreBundle\Entity\Product; | 
 
| 04 | useSymfony\Component\HttpFoundation\Response; | 
 
| 05 | classDefaultController extendsController | 
 
| 07 |     publicfunctioncreateProductAction() | 
 
| 09 |         $category= newCategory(); | 
 
| 10 |         $category->setName('Main Products'); | 
 
| 11 |         $product= newProduct(); | 
 
| 12 |         $product->setName('Foo'); | 
 
| 13 |         $product->setPrice(19.99); | 
 
| 14 |         // relate this product to the category | 
 
| 15 |         $product->setCategory($category); | 
 
| 16 |         $em= $this->getDoctrine()->getManager(); | 
 
| 17 |         $em->persist($category); | 
 
| 18 |         $em->persist($product); | 
 
| 21 |         'Created product id: '.$product->getId() | 
 
| 22 |         .' and category id: '.$category->getId() | 
 
 
 
     1.3 批量插入函数
| 08 | functionucWords($str) | 
 
| 10 |     $str= ucwords(str_replace('_', ' ', $str)); | 
 
| 11 |     $str= str_replace(' ', '', $str); | 
 
| 19 | * @param string $entity | 
 
| 20 | * @param array $dataList | 
 
| 23 | functionbatchInsertByEntity($entity, $dataList, $per= 1000) | 
 
| 25 |     $count= count($dataList); | 
 
| 26 |     for($i= 0; $i< $count; $i++) { | 
 
| 28 |         foreach($dataList[$i] as$k=> $v) { | 
 
| 29 |         $obj->{"set". $this->ucWords($k)}($v); | 
 
| 31 |         $this->em->persist($obj); | 
 
| 32 |         if(($count% $per) === 0) { | 
 
 
 
(2)删除记录:
| 01 | publicfunctiondeleteAction($id) | 
 
| 03 |     $em= $this->getDoctrine()->getManager(); | 
 
| 04 |     $product= $em->getRepository('AcmeStoreBundle:Product')->find($id); | 
 
| 07 |         throw$this->createNotFoundException( | 
 
| 08 |         'No product found for id '.$id | 
 
| 12 |     $em->remove($product);  //注意:此处是remove函数 | 
 
| 14 |     return$this->redirect($this->generateUrl('homepage')); | 
 
 
 
(3)查询记录:
参看这篇文章:Symfony2 Doctrine 数据库查询方法总结
												
												
								- CentOS 配置防火墙操作实例(启、停、开、闭端口):
		CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service   iptables status< ... 
- python操作mysql数据库的相关操作实例
		python操作mysql数据库的相关操作实例 # -*- coding: utf-8 -*- #python operate mysql database import MySQLdb #数据库名称 ... 
- 安卓 SQLite数据库操作实例
		前段时间写了个安卓平台下SQLite数据库操作的实例 ,一直没得时间总结 ,今天把它弄出来了. 在Android 运行时环境包含了完整的 SQLite. 首先介绍一下SQLite这个数据库: SQLi ... 
- 在安卓开发中使用SQLite数据库操作实例
		前段时间写了个安卓平台下SQLite数据库操作的实例 ,一直没得时间总结 ,今天把它弄出来了. 在Android 运行时环境包含了完整的 SQLite. 首先介绍一下SQLite这个数据库: SQLi ... 
- Sql Server 函数的操作实例!(执行多条语句,返回Select查询后的临时表)
		Sql Server 函数的操作实例!(执行多条语句,返回Select查询后的临时表) SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ==== ... 
- CentOS 配置防火墙操作实例(启、停、开、闭端口)CentOS Linux-FTP/对外开放端口(接口)TomCat相关
		链接地址:http://blog.csdn.net/jemlee2002/article/details/7042991 CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作 ... 
- Sql Server 函数的操作实例!(返回一条Select语句查询后的临时表)
		Sql Server 函数的操作实例!(返回一条Select语句查询后的临时表) SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE FUN ... 
- FTP命令具体解释(含操作实例)
		以下是微软命令行FTPclient命令大全.假设你想使用"未加工(RAW)"FTP命令而非以下翻译过的请參考:http://www.nsftools.com/tips/RawFTP ... 
- CentOS配置防火墙操作实例
		CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service iptables status<回 ... 
随机推荐
	
									- 用canvas播放scratch文件
			原文地址:https://blog.csdn.net/qq_36268036/article/details/84262540 基于Github上的scratch-render实现sb2或者sb3文件 ... 
- ajax实现跨域请求
			因为现在一直用的mvc,所以就以mvc来说说ajax跨域提交. 首先说说跨域,简单说就是不同域名访问,比如在aaa.com访问bbb.com. 就拿招聘网站来说,分为两种用户,求职者和企业,求职者端是 ... 
- 三、python小功能记录——杀掉进程
			import os os.system("taskkill /F /IM python.exe")#旧版 os.system("taskkill /F /IM py.ex ... 
- [翻译] VICMAImageView
			VICMAImageView https://github.com/vitoziv/VICMAImageView Change image view's content mode with your  ... 
- Python2.7 - IMOOC - 2
			第三章 Python变量和数据类型 3-1.数据类型 在Python中,能够直接处理的数据类型有以下几种: 整数 Python可以处理任意大小的整数,当然包括负整数,表示方法和数学上的写法一模一样,十 ... 
- yarn logs -applicationId [applicationID]
			yarn logs -applicationId application_1435648583743_0001 报错: tmp/logs/.../application_1435648583743_0 ... 
- Django的视图流式响应机制
			Django的视图流式响应机制 Django的响应类型:一次性响应和流式响应. 一次性响应,顾名思义,将响应内容一次性反馈给用户.HttpResponse类及子类和JsonResponse类属于一次性 ... 
- 如何使用Loadrunner12录制WebSocket脚本
			简单说一下,关于Loadrunner12对WebSocket的支持可以参照以下文档: http://community.hpe.com/t5/LoadRunner-and-Performance/As ... 
- MyBatis(2)-全局配置文件
			本文的代码是在MyBatis(1)-简单入门基础之上进行学习的,如有不懂请先看此博文MyBatis(1)-简单入门! 1)配置文件的安装 --->在联网的情况下,点击去下载http://myba ... 
- leetcode 20 括号匹配
			class Solution { public: bool isValid(string s) { stack<char> result; for(char c:s){ if(c == ' ...